2001-01-31 15:18:47 +00:00
|
|
|
|
/* Copyright (C) 1995,1996,1997,1998, 2000, 2001 Free Software Foundation, Inc.
|
1996-07-25 22:56:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* 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)
|
|
|
|
|
|
* any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this software; see the file COPYING. If not, write to
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
|
|
|
* Boston, MA 02111-1307 USA
|
1996-07-25 22:56:11 +00:00
|
|
|
|
*
|
|
|
|
|
|
* As a special exception, the Free Software Foundation gives permission
|
|
|
|
|
|
* for additional uses of the text contained in its release of GUILE.
|
|
|
|
|
|
*
|
|
|
|
|
|
* The exception is that, if you link the GUILE library with other files
|
|
|
|
|
|
* to produce an executable, this does not by itself cause the
|
|
|
|
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
|
|
|
|
* Your use of that executable is in no way restricted on account of
|
|
|
|
|
|
* linking the GUILE library code into it.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception does not however invalidate any other reasons why
|
|
|
|
|
|
* the executable file might be covered by the GNU General Public License.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This exception applies only to the code released by the
|
|
|
|
|
|
* Free Software Foundation under the name GUILE. If you copy
|
|
|
|
|
|
* code from other Free Software Foundation releases into a copy of
|
|
|
|
|
|
* GUILE, as the General Public License permits, the exception does
|
|
|
|
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
|
|
|
|
* anyone as to the status of such modified files, you must delete
|
|
|
|
|
|
* this exception notice from them.
|
|
|
|
|
|
*
|
|
|
|
|
|
* If you write modifications of your own for GUILE, it is your choice
|
|
|
|
|
|
* whether to permit this exception to apply to your modifications.
|
1997-05-26 22:34:48 +00:00
|
|
|
|
* If you do not wish that, delete this exception notice. */
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
|
|
|
|
|
|
gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
|
|
|
|
|
|
|
2000-03-09 18:58:58 +00:00
|
|
|
|
/*
|
|
|
|
|
|
This file has code for arrays in lots of variants (double, integer,
|
|
|
|
|
|
unsigned etc. ). It suffers from hugely repetitive code because
|
|
|
|
|
|
there is similar (but different) code for every variant included. (urg.)
|
|
|
|
|
|
|
|
|
|
|
|
--hwn
|
|
|
|
|
|
*/
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2001-03-09 23:33:41 +00:00
|
|
|
|
#include <string.h>
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/_scm.h"
|
|
|
|
|
|
#include "libguile/chars.h"
|
|
|
|
|
|
#include "libguile/eval.h"
|
|
|
|
|
|
#include "libguile/fports.h"
|
|
|
|
|
|
#include "libguile/smob.h"
|
|
|
|
|
|
#include "libguile/strop.h"
|
|
|
|
|
|
#include "libguile/feature.h"
|
|
|
|
|
|
#include "libguile/root.h"
|
|
|
|
|
|
#include "libguile/strings.h"
|
|
|
|
|
|
#include "libguile/vectors.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "libguile/validate.h"
|
|
|
|
|
|
#include "libguile/unif.h"
|
|
|
|
|
|
#include "libguile/ramap.h"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
/* The set of uniform scm_vector types is:
|
|
|
|
|
|
* Vector of: Called:
|
|
|
|
|
|
* unsigned char string
|
|
|
|
|
|
* char byvect
|
|
|
|
|
|
* boolean bvect
|
1998-07-16 22:21:06 +00:00
|
|
|
|
* signed long ivect
|
|
|
|
|
|
* unsigned long uvect
|
1996-07-25 22:56:11 +00:00
|
|
|
|
* float fvect
|
|
|
|
|
|
* double dvect
|
|
|
|
|
|
* complex double cvect
|
|
|
|
|
|
* short svect
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
* long long llvect
|
1996-07-25 22:56:11 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
2000-12-08 17:32:56 +00:00
|
|
|
|
scm_bits_t scm_tc16_array;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
/* return the size of an element in a uniform array or 0 if type not
|
|
|
|
|
|
found. */
|
|
|
|
|
|
scm_sizet
|
|
|
|
|
|
scm_uniform_element_size (SCM obj)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
scm_sizet result;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
switch (SCM_TYP7 (obj))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
case scm_tc7_bvect:
|
|
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
result = sizeof (long);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_byvect:
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
result = sizeof (char);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case scm_tc7_svect:
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
result = sizeof (short);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
result = sizeof (long_long);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
case scm_tc7_fvect:
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
result = sizeof (float);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_dvect:
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
result = sizeof (double);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_cvect:
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
result = 2 * sizeof (double);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
result = 0;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
* acconfig.h: add HAVE_ARRAYS.
* configure.in: add --disable-arrays option, probably temporary.
* the following changes allow guile to be built with the array
"module" omitted. some of this stuff is just tc7 type support,
which wouldn't be needed if uniform array types were converted
to smobs.
* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
HAVE_ARRAYS.
(scm_tag): don't check array types unless HAVE_ARRAYS.
* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
remove the unused array types.
* (scm_stable_sort, scm_sort): don't support vectors if not
HAVE_ARRAYS. a bit excessive.
* random.c (vector_scale, vector_sum_squares,
scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.
* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
gh_longs2ivect, gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
gh_uniform_vector_length, gh_uniform_vector_ref):
don't define unless HAVE_ARRAYS.
(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
gh_scm2doubles):
don't check vector types if not HAVE_ARRAYS.
* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
don't support the array types unless HAVE_ARRAYS is defined.
* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.
* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
defined (this should use read-hash-extend).
* ramap.c, unif.c: don't check whether ARRAYS is defined.
* vectors.c (scm_vector_set_length_x): moved here from unif.c. call
scm_uniform_element_size if HAVE_ARRAYS.
vectors.h: prototype too.
* unif.c (scm_uniform_element_size): new procedure.
* init.c (scm_boot_guile_1): don't call scm_init_ramap or
scm_init_unif unless HAVE_ARRAYS is defined.
* __scm.h: don't define ARRAYS.
* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
moved here from libguile_la_SOURCES.
* Makefile.am (ice9_sources): add arrays.scm.
* boot-9.scm: load arrays.scm if 'array is provided.
* arrays.scm: new file with stuff from boot-9.scm.
1999-11-19 18:16:19 +00:00
|
|
|
|
return result;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
/* Silly function used not to modify the semantics of the silly
|
|
|
|
|
|
* prototype system in order to be backward compatible.
|
|
|
|
|
|
*/
|
|
|
|
|
|
static int
|
|
|
|
|
|
singp (SCM obj)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
if (!SCM_SLOPPY_REALP (obj))
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
double x = SCM_REAL_VALUE (obj);
|
|
|
|
|
|
float fx = x;
|
|
|
|
|
|
return (- SCM_FLTMAX < x) && (x < SCM_FLTMAX) && (fx == x);
|
|
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_make_uve (long k, SCM prot)
|
2000-10-30 17:47:52 +00:00
|
|
|
|
#define FUNC_NAME "scm_make_uve"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM v;
|
|
|
|
|
|
long i, type;
|
2000-10-30 17:47:52 +00:00
|
|
|
|
|
2000-06-05 11:39:46 +00:00
|
|
|
|
if (SCM_EQ_P (prot, SCM_BOOL_T))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-11-23 08:59:22 +00:00
|
|
|
|
SCM_NEWCELL (v);
|
|
|
|
|
|
if (k > 0)
|
|
|
|
|
|
{
|
2000-11-23 15:26:24 +00:00
|
|
|
|
SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_BITVECTOR_MAX_LENGTH);
|
2000-11-23 08:59:22 +00:00
|
|
|
|
i = sizeof (long) * ((k + SCM_LONG_BIT - 1) / SCM_LONG_BIT);
|
2000-11-23 13:54:49 +00:00
|
|
|
|
SCM_SET_BITVECTOR_BASE (v, (char *) scm_must_malloc (i, "vector"));
|
2000-11-23 08:59:22 +00:00
|
|
|
|
SCM_SET_BITVECTOR_LENGTH (v, k);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2000-11-23 13:54:49 +00:00
|
|
|
|
SCM_SET_BITVECTOR_BASE (v, 0);
|
2000-11-23 08:59:22 +00:00
|
|
|
|
SCM_SET_BITVECTOR_LENGTH (v, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
return v;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
2000-04-04 12:13:41 +00:00
|
|
|
|
else if (SCM_CHARP (prot) && (SCM_CHAR (prot) == '\0'))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
i = sizeof (char) * k;
|
|
|
|
|
|
type = scm_tc7_byvect;
|
2000-11-23 15:26:24 +00:00
|
|
|
|
}
|
2000-03-02 20:54:43 +00:00
|
|
|
|
else if (SCM_CHARP (prot))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
i = sizeof (char) * k;
|
2000-11-23 08:59:22 +00:00
|
|
|
|
return scm_makstr (i, 0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
else if (SCM_INUMP (prot))
|
|
|
|
|
|
{
|
|
|
|
|
|
i = sizeof (long) * k;
|
|
|
|
|
|
if (SCM_INUM (prot) > 0)
|
|
|
|
|
|
type = scm_tc7_uvect;
|
|
|
|
|
|
else
|
|
|
|
|
|
type = scm_tc7_ivect;
|
|
|
|
|
|
}
|
2000-10-11 12:24:43 +00:00
|
|
|
|
else if (SCM_SYMBOLP (prot) && (1 == SCM_SYMBOL_LENGTH (prot)))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
char s;
|
|
|
|
|
|
|
2000-09-22 17:17:55 +00:00
|
|
|
|
s = SCM_SYMBOL_CHARS (prot)[0];
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (s == 's')
|
|
|
|
|
|
{
|
|
|
|
|
|
i = sizeof (short) * k;
|
|
|
|
|
|
type = scm_tc7_svect;
|
|
|
|
|
|
}
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
else if (s == 'l')
|
|
|
|
|
|
{
|
|
|
|
|
|
i = sizeof (long_long) * k;
|
|
|
|
|
|
type = scm_tc7_llvect;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2001-02-02 04:56:25 +00:00
|
|
|
|
return scm_c_make_vector (k, SCM_UNDEFINED);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2000-11-23 15:26:24 +00:00
|
|
|
|
else if (!SCM_INEXACTP (prot))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
/* Huge non-unif vectors are NOT supported. */
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
/* no special scm_vector */
|
2001-02-02 04:56:25 +00:00
|
|
|
|
return scm_c_make_vector (k, SCM_UNDEFINED);
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
else if (singp (prot))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
i = sizeof (float) * k;
|
|
|
|
|
|
type = scm_tc7_fvect;
|
|
|
|
|
|
}
|
2000-05-10 12:34:43 +00:00
|
|
|
|
else if (SCM_COMPLEXP (prot))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
i = 2 * sizeof (double) * k;
|
|
|
|
|
|
type = scm_tc7_cvect;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
i = sizeof (double) * k;
|
|
|
|
|
|
type = scm_tc7_dvect;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-11-23 15:26:24 +00:00
|
|
|
|
SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_UVECTOR_MAX_LENGTH);
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_NEWCELL (v);
|
|
|
|
|
|
SCM_DEFER_INTS;
|
2000-11-23 13:54:49 +00:00
|
|
|
|
SCM_SET_UVECTOR_BASE (v, (char *) scm_must_malloc (i ? i : 1, "vector"));
|
2000-11-23 08:59:22 +00:00
|
|
|
|
SCM_SET_UVECTOR_LENGTH (v, k, type);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ALLOW_INTS;
|
|
|
|
|
|
return v;
|
|
|
|
|
|
}
|
2000-10-30 17:47:52 +00:00
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_uniform_vector_length, "uniform-vector-length", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM v),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns the number of elements in @var{uve}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_uniform_vector_length
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM_ASRTGO (SCM_NIMP (v), badarg1);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
switch SCM_TYP7 (v)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg1:SCM_WRONG_TYPE_ARG (1, v);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
case scm_tc7_vector:
|
|
|
|
|
|
case scm_tc7_wvect:
|
|
|
|
|
|
return SCM_MAKINUM (SCM_VECTOR_LENGTH (v));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_string:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
return SCM_MAKINUM (SCM_STRING_LENGTH (v));
|
|
|
|
|
|
case scm_tc7_bvect:
|
|
|
|
|
|
return SCM_MAKINUM (SCM_BITVECTOR_LENGTH (v));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
case scm_tc7_fvect:
|
|
|
|
|
|
case scm_tc7_dvect:
|
|
|
|
|
|
case scm_tc7_cvect:
|
|
|
|
|
|
case scm_tc7_svect:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
|
|
|
|
|
#endif
|
2000-10-11 12:24:43 +00:00
|
|
|
|
return SCM_MAKINUM (SCM_UVECTOR_LENGTH (v));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_array_p, "array?", 1, 1, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM v, SCM prot),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns @code{#t} if the @var{obj} is an array, and @code{#f} if not.\n\n"
|
|
|
|
|
|
"The @var{prototype} argument is used with uniform arrays and is described\n"
|
|
|
|
|
|
"elsewhere.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_array_p
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
int nprot;
|
|
|
|
|
|
int enclosed;
|
|
|
|
|
|
nprot = SCM_UNBNDP (prot);
|
|
|
|
|
|
enclosed = 0;
|
|
|
|
|
|
if (SCM_IMP (v))
|
|
|
|
|
|
return SCM_BOOL_F;
|
2000-03-09 18:58:58 +00:00
|
|
|
|
|
|
|
|
|
|
while (SCM_TYP7 (v) == scm_tc7_smob)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (!SCM_ARRAYP (v))
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
if (nprot)
|
|
|
|
|
|
return SCM_BOOL_T;
|
|
|
|
|
|
if (enclosed++)
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
v = SCM_ARRAY_V (v);
|
2000-03-09 18:58:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
if (nprot)
|
|
|
|
|
|
return SCM_BOOL(nprot);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
int protp = 0;
|
|
|
|
|
|
|
|
|
|
|
|
switch (SCM_TYP7 (v))
|
|
|
|
|
|
{
|
|
|
|
|
|
case scm_tc7_bvect:
|
2000-06-05 11:39:46 +00:00
|
|
|
|
protp = (SCM_EQ_P (prot, SCM_BOOL_T));
|
2000-03-09 18:58:58 +00:00
|
|
|
|
case scm_tc7_string:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
protp = SCM_CHARP(prot) && (SCM_CHAR (prot) != '\0');
|
2000-03-09 18:58:58 +00:00
|
|
|
|
case scm_tc7_byvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
protp = SCM_EQ_P (prot, SCM_MAKE_CHAR ('\0'));
|
2000-03-09 18:58:58 +00:00
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
protp = SCM_INUMP(prot) && SCM_INUM(prot)>0;
|
|
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
protp = SCM_INUMP(prot) && SCM_INUM(prot)<=0;
|
|
|
|
|
|
|
|
|
|
|
|
case scm_tc7_svect:
|
|
|
|
|
|
protp = SCM_SYMBOLP (prot)
|
2000-10-11 12:24:43 +00:00
|
|
|
|
&& (1 == SCM_SYMBOL_LENGTH (prot))
|
2000-09-22 17:17:55 +00:00
|
|
|
|
&& ('s' == SCM_SYMBOL_CHARS (prot)[0]);
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
2000-03-09 18:58:58 +00:00
|
|
|
|
case scm_tc7_llvect:
|
|
|
|
|
|
protp = SCM_SYMBOLP (prot)
|
2000-10-11 12:24:43 +00:00
|
|
|
|
&& (1 == SCM_SYMBOL_LENGTH (prot))
|
2000-09-22 17:17:55 +00:00
|
|
|
|
&& ('s' == SCM_SYMBOL_CHARS (prot)[0]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
2000-03-09 18:58:58 +00:00
|
|
|
|
case scm_tc7_fvect:
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
protp = singp (prot);
|
2000-03-09 18:58:58 +00:00
|
|
|
|
case scm_tc7_dvect:
|
|
|
|
|
|
protp = SCM_REALP(prot);
|
|
|
|
|
|
case scm_tc7_cvect:
|
2000-05-10 12:34:43 +00:00
|
|
|
|
protp = SCM_COMPLEXP(prot);
|
2000-03-09 18:58:58 +00:00
|
|
|
|
case scm_tc7_vector:
|
|
|
|
|
|
case scm_tc7_wvect:
|
|
|
|
|
|
protp = SCM_NULLP(prot);
|
|
|
|
|
|
default:
|
|
|
|
|
|
/* no default */
|
|
|
|
|
|
;
|
|
|
|
|
|
}
|
|
|
|
|
|
return SCM_BOOL(protp);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_array_rank, "array-rank", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM ra),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns the number of dimensions of @var{obj}. If @var{obj} is not an\n"
|
|
|
|
|
|
"array, @code{0} is returned.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_array_rank
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (SCM_IMP (ra))
|
1999-12-12 02:36:16 +00:00
|
|
|
|
return SCM_INUM0;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
switch (SCM_TYP7 (ra))
|
|
|
|
|
|
{
|
|
|
|
|
|
default:
|
|
|
|
|
|
return SCM_INUM0;
|
|
|
|
|
|
case scm_tc7_string:
|
|
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
case scm_tc7_fvect:
|
|
|
|
|
|
case scm_tc7_cvect:
|
|
|
|
|
|
case scm_tc7_dvect:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
|
|
|
|
|
#endif
|
|
|
|
|
|
case scm_tc7_svect:
|
|
|
|
|
|
return SCM_MAKINUM (1L);
|
|
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
if (SCM_ARRAYP (ra))
|
|
|
|
|
|
return SCM_MAKINUM (SCM_ARRAY_NDIM (ra));
|
|
|
|
|
|
return SCM_INUM0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_array_dimensions, "array-dimensions", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM ra),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"@code{Array-dimensions} is similar to @code{array-shape} but replaces\n"
|
|
|
|
|
|
"elements with a @code{0} minimum with one greater than the maximum. So:\n"
|
|
|
|
|
|
"@example\n"
|
|
|
|
|
|
"(array-dimensions (make-array 'foo '(-1 3) 5)) @result{} ((-1 3) 5)\n"
|
|
|
|
|
|
"@end example")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_array_dimensions
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM res = SCM_EOL;
|
|
|
|
|
|
scm_sizet k;
|
|
|
|
|
|
scm_array_dim *s;
|
|
|
|
|
|
if (SCM_IMP (ra))
|
1999-12-12 02:36:16 +00:00
|
|
|
|
return SCM_BOOL_F;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
switch (SCM_TYP7 (ra))
|
|
|
|
|
|
{
|
|
|
|
|
|
default:
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
case scm_tc7_string:
|
|
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_bvect:
|
|
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
case scm_tc7_fvect:
|
|
|
|
|
|
case scm_tc7_cvect:
|
|
|
|
|
|
case scm_tc7_dvect:
|
|
|
|
|
|
case scm_tc7_svect:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
|
|
|
|
|
#endif
|
2000-10-11 12:24:43 +00:00
|
|
|
|
return scm_cons (scm_uniform_vector_length (ra), SCM_EOL);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
if (!SCM_ARRAYP (ra))
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
k = SCM_ARRAY_NDIM (ra);
|
|
|
|
|
|
s = SCM_ARRAY_DIMS (ra);
|
|
|
|
|
|
while (k--)
|
2000-04-13 03:44:51 +00:00
|
|
|
|
res = scm_cons (s[k].lbnd
|
|
|
|
|
|
? scm_cons2 (SCM_MAKINUM (s[k].lbnd),
|
|
|
|
|
|
SCM_MAKINUM (s[k].ubnd),
|
|
|
|
|
|
SCM_EOL)
|
|
|
|
|
|
: SCM_MAKINUM (1 + s[k].ubnd),
|
|
|
|
|
|
res);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-04-13 03:44:51 +00:00
|
|
|
|
SCM_DEFINE (scm_shared_array_root, "shared-array-root", 1, 0, 0,
|
|
|
|
|
|
(SCM ra),
|
|
|
|
|
|
"Return the root vector of a shared array.")
|
|
|
|
|
|
#define FUNC_NAME s_scm_shared_array_root
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ASSERT (SCM_ARRAYP (ra), ra, SCM_ARG1, FUNC_NAME);
|
|
|
|
|
|
return SCM_ARRAY_V (ra);
|
|
|
|
|
|
}
|
|
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SCM_DEFINE (scm_shared_array_offset, "shared-array-offset", 1, 0, 0,
|
|
|
|
|
|
(SCM ra),
|
|
|
|
|
|
"Return the root vector index of the first element in the array.")
|
|
|
|
|
|
#define FUNC_NAME s_scm_shared_array_offset
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ASSERT (SCM_ARRAYP (ra), ra, SCM_ARG1, FUNC_NAME);
|
|
|
|
|
|
return SCM_MAKINUM (SCM_ARRAY_BASE (ra));
|
|
|
|
|
|
}
|
|
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SCM_DEFINE (scm_shared_array_increments, "shared-array-increments", 1, 0, 0,
|
|
|
|
|
|
(SCM ra),
|
|
|
|
|
|
"For each dimension, return the distance between elements in the root vector.")
|
|
|
|
|
|
#define FUNC_NAME s_scm_shared_array_increments
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM res = SCM_EOL;
|
|
|
|
|
|
scm_sizet k;
|
|
|
|
|
|
scm_array_dim *s;
|
|
|
|
|
|
SCM_ASSERT (SCM_ARRAYP (ra), ra, SCM_ARG1, FUNC_NAME);
|
|
|
|
|
|
k = SCM_ARRAY_NDIM (ra);
|
|
|
|
|
|
s = SCM_ARRAY_DIMS (ra);
|
|
|
|
|
|
while (k--)
|
|
|
|
|
|
res = scm_cons (SCM_MAKINUM (s[k].inc), res);
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
static char s_bad_ind[] = "Bad scm_array index";
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
long
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_aind (SCM ra, SCM args, const char *what)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM ind;
|
|
|
|
|
|
register long j;
|
|
|
|
|
|
register scm_sizet pos = SCM_ARRAY_BASE (ra);
|
|
|
|
|
|
register scm_sizet k = SCM_ARRAY_NDIM (ra);
|
|
|
|
|
|
scm_array_dim *s = SCM_ARRAY_DIMS (ra);
|
|
|
|
|
|
if (SCM_INUMP (args))
|
|
|
|
|
|
{
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
SCM_ASSERT (1 == k, scm_makfrom0str (what), SCM_WNA, NULL);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return pos + (SCM_INUM (args) - s->lbnd) * (s->inc);
|
|
|
|
|
|
}
|
|
|
|
|
|
while (k && SCM_NIMP (args))
|
|
|
|
|
|
{
|
|
|
|
|
|
ind = SCM_CAR (args);
|
|
|
|
|
|
args = SCM_CDR (args);
|
|
|
|
|
|
SCM_ASSERT (SCM_INUMP (ind), ind, s_bad_ind, what);
|
|
|
|
|
|
j = SCM_INUM (ind);
|
2000-06-30 10:46:35 +00:00
|
|
|
|
if (j < s->lbnd || j > s->ubnd)
|
|
|
|
|
|
scm_out_of_range (what, ind);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
pos += (j - s->lbnd) * (s->inc);
|
|
|
|
|
|
k--;
|
|
|
|
|
|
s++;
|
|
|
|
|
|
}
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
SCM_ASSERT (0 == k && SCM_NULLP (args), scm_makfrom0str (what), SCM_WNA,
|
|
|
|
|
|
NULL);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return pos;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_make_ra (int ndim)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM ra;
|
|
|
|
|
|
SCM_NEWCELL (ra);
|
|
|
|
|
|
SCM_DEFER_INTS;
|
1999-07-07 09:44:01 +00:00
|
|
|
|
SCM_NEWSMOB(ra, ((long) ndim << 17) + scm_tc16_array,
|
|
|
|
|
|
scm_must_malloc ((long) (sizeof (scm_array) + ndim * sizeof (scm_array_dim)),
|
1996-07-25 22:56:11 +00:00
|
|
|
|
"array"));
|
|
|
|
|
|
SCM_ARRAY_V (ra) = scm_nullvect;
|
|
|
|
|
|
SCM_ALLOW_INTS;
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static char s_bad_spec[] = "Bad scm_array dimension";
|
|
|
|
|
|
/* Increments will still need to be set. */
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_shap2ra (SCM args, const char *what)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_array_dim *s;
|
|
|
|
|
|
SCM ra, spec, sp;
|
|
|
|
|
|
int ndim = scm_ilength (args);
|
|
|
|
|
|
SCM_ASSERT (0 <= ndim, args, s_bad_spec, what);
|
|
|
|
|
|
ra = scm_make_ra (ndim);
|
|
|
|
|
|
SCM_ARRAY_BASE (ra) = 0;
|
|
|
|
|
|
s = SCM_ARRAY_DIMS (ra);
|
2000-10-30 17:47:52 +00:00
|
|
|
|
for (; !SCM_NULLP (args); s++, args = SCM_CDR (args))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
spec = SCM_CAR (args);
|
2000-10-30 17:47:52 +00:00
|
|
|
|
if (SCM_INUMP (spec))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-10-30 17:47:52 +00:00
|
|
|
|
SCM_ASSERT (SCM_INUM (spec) >= 0, spec, s_bad_spec, what);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
s->lbnd = 0;
|
|
|
|
|
|
s->ubnd = SCM_INUM (spec) - 1;
|
|
|
|
|
|
s->inc = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
1997-08-30 19:28:38 +00:00
|
|
|
|
SCM_ASSERT (SCM_CONSP (spec) && SCM_INUMP (SCM_CAR (spec)), spec,
|
|
|
|
|
|
s_bad_spec, what);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
s->lbnd = SCM_INUM (SCM_CAR (spec));
|
|
|
|
|
|
sp = SCM_CDR (spec);
|
1999-12-16 20:48:05 +00:00
|
|
|
|
SCM_ASSERT (SCM_CONSP (sp)
|
1997-08-30 19:28:38 +00:00
|
|
|
|
&& SCM_INUMP (SCM_CAR (sp)) && SCM_NULLP (SCM_CDR (sp)),
|
|
|
|
|
|
spec, s_bad_spec, what);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
s->ubnd = SCM_INUM (SCM_CAR (sp));
|
|
|
|
|
|
s->inc = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_dimensions_to_uniform_array, "dimensions->uniform-array", 2, 1, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM dims, SCM prot, SCM fill),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"@deffnx primitive make-uniform-vector length prototype [fill]\n"
|
|
|
|
|
|
"Creates and returns a uniform array or vector of type corresponding to\n"
|
|
|
|
|
|
"@var{prototype} with dimensions @var{dims} or length @var{length}. If\n"
|
|
|
|
|
|
"@var{fill} is supplied, it's used to fill the array, otherwise \n"
|
|
|
|
|
|
"@var{prototype} is used.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_dimensions_to_uniform_array
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-10-30 17:47:52 +00:00
|
|
|
|
scm_sizet k;
|
|
|
|
|
|
unsigned long int rlen = 1;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_array_dim *s;
|
|
|
|
|
|
SCM ra;
|
|
|
|
|
|
if (SCM_INUMP (dims))
|
1998-03-30 21:03:35 +00:00
|
|
|
|
{
|
2000-11-23 15:26:24 +00:00
|
|
|
|
SCM answer = scm_make_uve (SCM_INUM (dims), prot);
|
2000-10-30 17:47:52 +00:00
|
|
|
|
if (!SCM_UNBNDP (fill))
|
|
|
|
|
|
scm_array_fill_x (answer, fill);
|
|
|
|
|
|
else if (SCM_SYMBOLP (prot))
|
|
|
|
|
|
scm_array_fill_x (answer, SCM_MAKINUM (0));
|
|
|
|
|
|
else
|
|
|
|
|
|
scm_array_fill_x (answer, prot);
|
|
|
|
|
|
return answer;
|
1998-03-30 21:03:35 +00:00
|
|
|
|
}
|
1999-12-16 20:48:05 +00:00
|
|
|
|
SCM_ASSERT (SCM_NULLP (dims) || SCM_CONSP (dims),
|
|
|
|
|
|
dims, SCM_ARG1, FUNC_NAME);
|
1999-12-12 02:36:16 +00:00
|
|
|
|
ra = scm_shap2ra (dims, FUNC_NAME);
|
* pairs.h, eval.c, gc.c, init.c, ioext.c, ports.c, ports.h,
srcprop.h, tags.h, throw.c, unif.c: Added new selectors
SCM_SETAND_CAR, SCM_SETAND_CDR, SCM_SETOR_CAR and SCM_SETOR_CDR.
Motivation: Safer use. Some other macros are defined in terms of
these operations. If these are defined using the SCM_SETCXR
(<e1>, SCM_CXR (<e1>) <op> <e2>) pattern a complex <e1> will lead
to inefficiency and an <e1> with side-effects could potentially
break. Also, these particular operations are heavily utilized in
the garbage collector. In unoptimized code there will be a
measurable speedup.
* alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c,
eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c,
ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h,
pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c,
procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h,
strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c,
vports.c: Cleaned up use of pairs: Don't make any special
assumptions about the internal structure of selectors and
mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>),
SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc.
(Among other things, this change makes it easier to build Guile
with certain compilers which have problems with casted lvalues.)
1996-10-20 03:28:34 +00:00
|
|
|
|
SCM_SETOR_CAR (ra, SCM_ARRAY_CONTIGUOUS);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
s = SCM_ARRAY_DIMS (ra);
|
|
|
|
|
|
k = SCM_ARRAY_NDIM (ra);
|
|
|
|
|
|
while (k--)
|
|
|
|
|
|
{
|
2000-10-30 17:47:52 +00:00
|
|
|
|
s[k].inc = rlen;
|
|
|
|
|
|
SCM_ASSERT_RANGE (1, dims, s[k].lbnd <= s[k].ubnd);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
rlen = (s[k].ubnd - s[k].lbnd + 1) * s[k].inc;
|
|
|
|
|
|
}
|
2000-10-30 17:47:52 +00:00
|
|
|
|
|
|
|
|
|
|
SCM_ARRAY_V (ra) = scm_make_uve (rlen, prot);
|
|
|
|
|
|
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
if (!SCM_UNBNDP (fill))
|
2000-10-30 17:47:52 +00:00
|
|
|
|
scm_array_fill_x (ra, fill);
|
1999-12-16 20:48:05 +00:00
|
|
|
|
else if (SCM_SYMBOLP (prot))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_array_fill_x (ra, SCM_MAKINUM (0));
|
|
|
|
|
|
else
|
|
|
|
|
|
scm_array_fill_x (ra, prot);
|
2000-10-30 17:47:52 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (1 == SCM_ARRAY_NDIM (ra) && 0 == SCM_ARRAY_BASE (ra))
|
|
|
|
|
|
if (s->ubnd < s->lbnd || (0 == s->lbnd && 1 == s->inc))
|
|
|
|
|
|
return SCM_ARRAY_V (ra);
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_ra_set_contp (SCM ra)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
scm_sizet k = SCM_ARRAY_NDIM (ra);
|
|
|
|
|
|
if (k)
|
|
|
|
|
|
{
|
1996-10-11 07:58:00 +00:00
|
|
|
|
long inc = SCM_ARRAY_DIMS (ra)[k - 1].inc;
|
|
|
|
|
|
while (k--)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
1996-10-11 07:58:00 +00:00
|
|
|
|
if (inc != SCM_ARRAY_DIMS (ra)[k].inc)
|
|
|
|
|
|
{
|
* pairs.h, eval.c, gc.c, init.c, ioext.c, ports.c, ports.h,
srcprop.h, tags.h, throw.c, unif.c: Added new selectors
SCM_SETAND_CAR, SCM_SETAND_CDR, SCM_SETOR_CAR and SCM_SETOR_CDR.
Motivation: Safer use. Some other macros are defined in terms of
these operations. If these are defined using the SCM_SETCXR
(<e1>, SCM_CXR (<e1>) <op> <e2>) pattern a complex <e1> will lead
to inefficiency and an <e1> with side-effects could potentially
break. Also, these particular operations are heavily utilized in
the garbage collector. In unoptimized code there will be a
measurable speedup.
* alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c,
eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c,
ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h,
pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c,
procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h,
strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c,
vports.c: Cleaned up use of pairs: Don't make any special
assumptions about the internal structure of selectors and
mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>),
SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc.
(Among other things, this change makes it easier to build Guile
with certain compilers which have problems with casted lvalues.)
1996-10-20 03:28:34 +00:00
|
|
|
|
SCM_SETAND_CAR (ra, ~SCM_ARRAY_CONTIGUOUS);
|
1996-10-11 07:58:00 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
inc *= (SCM_ARRAY_DIMS (ra)[k].ubnd
|
|
|
|
|
|
- SCM_ARRAY_DIMS (ra)[k].lbnd + 1);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
* pairs.h, eval.c, gc.c, init.c, ioext.c, ports.c, ports.h,
srcprop.h, tags.h, throw.c, unif.c: Added new selectors
SCM_SETAND_CAR, SCM_SETAND_CDR, SCM_SETOR_CAR and SCM_SETOR_CDR.
Motivation: Safer use. Some other macros are defined in terms of
these operations. If these are defined using the SCM_SETCXR
(<e1>, SCM_CXR (<e1>) <op> <e2>) pattern a complex <e1> will lead
to inefficiency and an <e1> with side-effects could potentially
break. Also, these particular operations are heavily utilized in
the garbage collector. In unoptimized code there will be a
measurable speedup.
* alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c,
eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c,
ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h,
pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c,
procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h,
strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c,
vports.c: Cleaned up use of pairs: Don't make any special
assumptions about the internal structure of selectors and
mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>),
SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc.
(Among other things, this change makes it easier to build Guile
with certain compilers which have problems with casted lvalues.)
1996-10-20 03:28:34 +00:00
|
|
|
|
SCM_SETOR_CAR (ra, SCM_ARRAY_CONTIGUOUS);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM oldra, SCM mapfunc, SCM dims),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"@code{make-shared-array} can be used to create shared subarrays of other\n"
|
|
|
|
|
|
"arrays. The @var{mapper} is a function that translates coordinates in\n"
|
|
|
|
|
|
"the new array into coordinates in the old array. A @var{mapper} must be\n"
|
|
|
|
|
|
"linear, and its range must stay within the bounds of the old array, but\n"
|
|
|
|
|
|
"it can be otherwise arbitrary. A simple example:\n"
|
|
|
|
|
|
"@example\n"
|
|
|
|
|
|
"(define fred (make-array #f 8 8))\n"
|
|
|
|
|
|
"(define freds-diagonal\n"
|
|
|
|
|
|
" (make-shared-array fred (lambda (i) (list i i)) 8))\n"
|
|
|
|
|
|
"(array-set! freds-diagonal 'foo 3)\n"
|
|
|
|
|
|
"(array-ref fred 3 3) @result{} foo\n"
|
|
|
|
|
|
"(define freds-center\n"
|
|
|
|
|
|
" (make-shared-array fred (lambda (i j) (list (+ 3 i) (+ 3 j))) 2 2))\n"
|
|
|
|
|
|
"(array-ref freds-center 0 0) @result{} foo\n"
|
|
|
|
|
|
"@end example")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_make_shared_array
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM ra;
|
|
|
|
|
|
SCM inds, indptr;
|
|
|
|
|
|
SCM imap;
|
|
|
|
|
|
scm_sizet i, k;
|
|
|
|
|
|
long old_min, new_min, old_max, new_max;
|
|
|
|
|
|
scm_array_dim *s;
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_VALIDATE_ARRAY (1,oldra);
|
|
|
|
|
|
SCM_VALIDATE_PROC (2,mapfunc);
|
1999-12-12 02:36:16 +00:00
|
|
|
|
ra = scm_shap2ra (dims, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (SCM_ARRAYP (oldra))
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ARRAY_V (ra) = SCM_ARRAY_V (oldra);
|
|
|
|
|
|
old_min = old_max = SCM_ARRAY_BASE (oldra);
|
|
|
|
|
|
s = SCM_ARRAY_DIMS (oldra);
|
|
|
|
|
|
k = SCM_ARRAY_NDIM (oldra);
|
|
|
|
|
|
while (k--)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (s[k].inc > 0)
|
|
|
|
|
|
old_max += (s[k].ubnd - s[k].lbnd) * s[k].inc;
|
|
|
|
|
|
else
|
|
|
|
|
|
old_min += (s[k].ubnd - s[k].lbnd) * s[k].inc;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ARRAY_V (ra) = oldra;
|
|
|
|
|
|
old_min = 0;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
old_max = SCM_INUM (scm_uniform_vector_length (oldra)) - 1;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
inds = SCM_EOL;
|
|
|
|
|
|
s = SCM_ARRAY_DIMS (ra);
|
|
|
|
|
|
for (k = 0; k < SCM_ARRAY_NDIM (ra); k++)
|
|
|
|
|
|
{
|
|
|
|
|
|
inds = scm_cons (SCM_MAKINUM (s[k].lbnd), inds);
|
|
|
|
|
|
if (s[k].ubnd < s[k].lbnd)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (1 == SCM_ARRAY_NDIM (ra))
|
|
|
|
|
|
ra = scm_make_uve (0L, scm_array_prototype (ra));
|
|
|
|
|
|
else
|
|
|
|
|
|
SCM_ARRAY_V (ra) = scm_make_uve (0L, scm_array_prototype (ra));
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
* list.h (SCM_LISTn): New macros. Make list creation in C code
prettier. The idea comes from STk.
* sequences.h, sequences.c, append.h, append.c: Removed. These
files implemented non-R4RS operations which would encourage
non-portable programming style and less easy-to-read code.
* Makefile.am (sequences.h, sequences.c, append.h, append.c):
Removed.
* libguile.h, eval.c, init.c, stime.c, unif.c: Removed #include
sequences.h, #include append.h.
* gh.h, gh_list.c: Renamed gh_list_length --> gh_length.
* list.h, list.c: Renamed scm_list_length --> scm_length, scm
1997-09-15 21:20:48 +00:00
|
|
|
|
imap = scm_apply (mapfunc, scm_reverse (inds), SCM_EOL);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (SCM_ARRAYP (oldra))
|
1999-12-12 02:36:16 +00:00
|
|
|
|
i = (scm_sizet) scm_aind (oldra, imap, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (SCM_NINUMP (imap))
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ASSERT (1 == scm_ilength (imap) && SCM_INUMP (SCM_CAR (imap)),
|
1999-12-12 02:36:16 +00:00
|
|
|
|
imap, s_bad_ind, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
imap = SCM_CAR (imap);
|
|
|
|
|
|
}
|
|
|
|
|
|
i = SCM_INUM (imap);
|
|
|
|
|
|
}
|
|
|
|
|
|
SCM_ARRAY_BASE (ra) = new_min = new_max = i;
|
|
|
|
|
|
indptr = inds;
|
|
|
|
|
|
k = SCM_ARRAY_NDIM (ra);
|
|
|
|
|
|
while (k--)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (s[k].ubnd > s[k].lbnd)
|
|
|
|
|
|
{
|
* pairs.h, eval.c, gc.c, init.c, ioext.c, ports.c, ports.h,
srcprop.h, tags.h, throw.c, unif.c: Added new selectors
SCM_SETAND_CAR, SCM_SETAND_CDR, SCM_SETOR_CAR and SCM_SETOR_CDR.
Motivation: Safer use. Some other macros are defined in terms of
these operations. If these are defined using the SCM_SETCXR
(<e1>, SCM_CXR (<e1>) <op> <e2>) pattern a complex <e1> will lead
to inefficiency and an <e1> with side-effects could potentially
break. Also, these particular operations are heavily utilized in
the garbage collector. In unoptimized code there will be a
measurable speedup.
* alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c,
eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c,
ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h,
pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c,
procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h,
strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c,
vports.c: Cleaned up use of pairs: Don't make any special
assumptions about the internal structure of selectors and
mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>),
SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc.
(Among other things, this change makes it easier to build Guile
with certain compilers which have problems with casted lvalues.)
1996-10-20 03:28:34 +00:00
|
|
|
|
SCM_SETCAR (indptr, SCM_MAKINUM (SCM_INUM (SCM_CAR (indptr)) + 1));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
imap = scm_apply (mapfunc, scm_reverse (inds), SCM_EOL);
|
|
|
|
|
|
if (SCM_ARRAYP (oldra))
|
|
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
s[k].inc = scm_aind (oldra, imap, FUNC_NAME) - i;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (SCM_NINUMP (imap))
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ASSERT (1 == scm_ilength (imap) && SCM_INUMP (SCM_CAR (imap)),
|
1999-12-12 02:36:16 +00:00
|
|
|
|
imap, s_bad_ind, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
imap = SCM_CAR (imap);
|
|
|
|
|
|
}
|
|
|
|
|
|
s[k].inc = (long) SCM_INUM (imap) - i;
|
|
|
|
|
|
}
|
|
|
|
|
|
i += s[k].inc;
|
|
|
|
|
|
if (s[k].inc > 0)
|
|
|
|
|
|
new_max += (s[k].ubnd - s[k].lbnd) * s[k].inc;
|
|
|
|
|
|
else
|
|
|
|
|
|
new_min += (s[k].ubnd - s[k].lbnd) * s[k].inc;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
s[k].inc = new_max - new_min + 1; /* contiguous by default */
|
|
|
|
|
|
indptr = SCM_CDR (indptr);
|
|
|
|
|
|
}
|
|
|
|
|
|
SCM_ASSERT (old_min <= new_min && old_max >= new_max, SCM_UNDEFINED,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
"mapping out of range", FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (1 == SCM_ARRAY_NDIM (ra) && 0 == SCM_ARRAY_BASE (ra))
|
|
|
|
|
|
{
|
2000-10-11 12:24:43 +00:00
|
|
|
|
SCM v = SCM_ARRAY_V (ra);
|
|
|
|
|
|
unsigned long int length = SCM_INUM (scm_uniform_vector_length (v));
|
|
|
|
|
|
if (1 == s->inc && 0 == s->lbnd && length == 1 + s->ubnd)
|
|
|
|
|
|
return v;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (s->ubnd < s->lbnd)
|
|
|
|
|
|
return scm_make_uve (0L, scm_array_prototype (ra));
|
|
|
|
|
|
}
|
|
|
|
|
|
scm_ra_set_contp (ra);
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* args are RA . DIMS */
|
2000-05-18 08:47:52 +00:00
|
|
|
|
SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
|
|
|
|
|
|
(SCM ra, SCM args),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns an array sharing contents with @var{array}, but with dimensions\n"
|
|
|
|
|
|
"arranged in a different order. There must be one @var{dim} argument for\n"
|
|
|
|
|
|
"each dimension of @var{array}. @var{dim0}, @var{dim1}, @dots{} should\n"
|
|
|
|
|
|
"be integers between 0 and the rank of the array to be returned. Each\n"
|
|
|
|
|
|
"integer in that range must appear at least once in the argument list.\n\n"
|
|
|
|
|
|
"The values of @var{dim0}, @var{dim1}, @dots{} correspond to dimensions\n"
|
|
|
|
|
|
"in the array to be returned, their positions in the argument list to\n"
|
|
|
|
|
|
"dimensions of @var{array}. Several @var{dim}s may have the same value,\n"
|
|
|
|
|
|
"in which case the returned array will have smaller rank than\n"
|
|
|
|
|
|
"@var{array}.\n\n"
|
|
|
|
|
|
"examples:\n"
|
|
|
|
|
|
"@example\n"
|
|
|
|
|
|
"(transpose-array '#2((a b) (c d)) 1 0) @result{} #2((a c) (b d))\n"
|
|
|
|
|
|
"(transpose-array '#2((a b) (c d)) 0 0) @result{} #1(a d)\n"
|
|
|
|
|
|
"(transpose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 1 0) @result{}\n"
|
|
|
|
|
|
" #2((a 4) (b 5) (c 6))\n"
|
|
|
|
|
|
"@end example")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_transpose_array
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-05-18 08:47:52 +00:00
|
|
|
|
SCM res, vargs, *ve = &vargs;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_array_dim *s, *r;
|
|
|
|
|
|
int ndim, i, k;
|
2000-05-18 08:47:52 +00:00
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_ASSERT (SCM_NIMP (ra), ra, SCM_ARG1, FUNC_NAME);
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
switch (SCM_TYP7 (ra))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg:SCM_WRONG_TYPE_ARG (1, ra);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_bvect:
|
|
|
|
|
|
case scm_tc7_string:
|
|
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
case scm_tc7_fvect:
|
|
|
|
|
|
case scm_tc7_dvect:
|
|
|
|
|
|
case scm_tc7_cvect:
|
|
|
|
|
|
case scm_tc7_svect:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
|
|
|
|
|
#endif
|
2000-05-18 08:47:52 +00:00
|
|
|
|
SCM_ASSERT (!SCM_NULLP (args) && SCM_NULLP (SCM_CDR (args)),
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_makfrom0str (FUNC_NAME), SCM_WNA, NULL);
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
SCM_ASSERT (SCM_INUMP (SCM_CAR (args)), SCM_CAR (args), SCM_ARG2,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
FUNC_NAME);
|
2000-06-30 10:46:35 +00:00
|
|
|
|
SCM_ASSERT_RANGE (SCM_ARG2, SCM_CAR (args),
|
|
|
|
|
|
SCM_EQ_P (SCM_INUM0, SCM_CAR (args)));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return ra;
|
|
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
SCM_ASRTGO (SCM_ARRAYP (ra), badarg);
|
|
|
|
|
|
vargs = scm_vector (args);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
SCM_ASSERT (SCM_VECTOR_LENGTH (vargs) == SCM_ARRAY_NDIM (ra),
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_makfrom0str (FUNC_NAME), SCM_WNA, NULL);
|
* filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).
* error.c, fports.c: replace use of %S in lgh_error args with %s.
%S will be used instead for write'ing arguments.
* unif.c (scm_transpose_array): change arguments in the SCM_WNA
asserts. fix a few other asserts.
(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
scm_uniform_vector_ref, scm_array_set_x,
scm_dimensions_to_unform_array): change args in
SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
scm_substring_fill_x): likewise.
gsubr.c (scm_gsubr_apply): likewise.
eval.c (SCM_APPLY): likewise.
* eval.c (4 places): replace scm_everr with lgh_error or
scm_wrong_num_args.
* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
scm_memory_error): new procedures.
* scm_everr: deleted. can use scm_wta, dropping first two args.
scm_error: convert NULL subr to SCM_BOOL_F.
* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
SCM_ARGERR.
* stackchk.c (scm_report_stack_overflow): use lgh_error instead
of scm_wta.
* error.c, error.h: new error keys: scm_arg_type_key,
scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
scm_misc_error_key.
scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
|
|
|
|
ve = SCM_VELTS (vargs);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
ndim = 0;
|
|
|
|
|
|
for (k = 0; k < SCM_ARRAY_NDIM (ra); k++)
|
|
|
|
|
|
{
|
1997-08-30 19:28:38 +00:00
|
|
|
|
SCM_ASSERT (SCM_INUMP (ve[k]), ve[k], (SCM_ARG2 + k),
|
1999-12-12 02:36:16 +00:00
|
|
|
|
FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
i = SCM_INUM (ve[k]);
|
2000-06-30 10:46:35 +00:00
|
|
|
|
if (i < 0 || i >= SCM_ARRAY_NDIM (ra))
|
|
|
|
|
|
scm_out_of_range (FUNC_NAME, ve[k]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (ndim < i)
|
|
|
|
|
|
ndim = i;
|
|
|
|
|
|
}
|
|
|
|
|
|
ndim++;
|
|
|
|
|
|
res = scm_make_ra (ndim);
|
|
|
|
|
|
SCM_ARRAY_V (res) = SCM_ARRAY_V (ra);
|
|
|
|
|
|
SCM_ARRAY_BASE (res) = SCM_ARRAY_BASE (ra);
|
|
|
|
|
|
for (k = ndim; k--;)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].lbnd = 0;
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].ubnd = -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
for (k = SCM_ARRAY_NDIM (ra); k--;)
|
|
|
|
|
|
{
|
|
|
|
|
|
i = SCM_INUM (ve[k]);
|
|
|
|
|
|
s = &(SCM_ARRAY_DIMS (ra)[k]);
|
|
|
|
|
|
r = &(SCM_ARRAY_DIMS (res)[i]);
|
|
|
|
|
|
if (r->ubnd < r->lbnd)
|
|
|
|
|
|
{
|
|
|
|
|
|
r->lbnd = s->lbnd;
|
|
|
|
|
|
r->ubnd = s->ubnd;
|
|
|
|
|
|
r->inc = s->inc;
|
|
|
|
|
|
ndim--;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (r->ubnd > s->ubnd)
|
|
|
|
|
|
r->ubnd = s->ubnd;
|
|
|
|
|
|
if (r->lbnd < s->lbnd)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ARRAY_BASE (res) += (s->lbnd - r->lbnd) * r->inc;
|
|
|
|
|
|
r->lbnd = s->lbnd;
|
|
|
|
|
|
}
|
|
|
|
|
|
r->inc += s->inc;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_ASSERT (ndim <= 0, args, "bad argument list", FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_ra_set_contp (res);
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
/* args are RA . AXES */
|
2000-05-18 08:47:52 +00:00
|
|
|
|
SCM_DEFINE (scm_enclose_array, "enclose-array", 1, 0, 1,
|
|
|
|
|
|
(SCM ra, SCM axes),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"@var{dim0}, @var{dim1} @dots{} should be nonnegative integers less than\n"
|
|
|
|
|
|
"the rank of @var{array}. @var{enclose-array} returns an array\n"
|
|
|
|
|
|
"resembling an array of shared arrays. The dimensions of each shared\n"
|
|
|
|
|
|
"array are the same as the @var{dim}th dimensions of the original array,\n"
|
|
|
|
|
|
"the dimensions of the outer array are the same as those of the original\n"
|
|
|
|
|
|
"array that did not match a @var{dim}.\n\n"
|
|
|
|
|
|
"An enclosed array is not a general Scheme array. Its elements may not\n"
|
|
|
|
|
|
"be set using @code{array-set!}. Two references to the same element of\n"
|
|
|
|
|
|
"an enclosed array will be @code{equal?} but will not in general be\n"
|
|
|
|
|
|
"@code{eq?}. The value returned by @var{array-prototype} when given an\n"
|
|
|
|
|
|
"enclosed array is unspecified.\n\n"
|
|
|
|
|
|
"examples:\n"
|
|
|
|
|
|
"@example\n"
|
|
|
|
|
|
"(enclose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1) @result{}\n"
|
|
|
|
|
|
" #<enclosed-array (#1(a d) #1(b e) #1(c f)) (#1(1 4) #1(2 5) #1(3 6))>\n\n"
|
|
|
|
|
|
"(enclose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 0) @result{}\n"
|
|
|
|
|
|
" #<enclosed-array #2((a 1) (d 4)) #2((b 2) (e 5)) #2((c 3) (f 6))>\n"
|
|
|
|
|
|
"@end example")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_enclose_array
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-05-18 08:47:52 +00:00
|
|
|
|
SCM axv, res, ra_inr;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_array_dim vdim, *s = &vdim;
|
|
|
|
|
|
int ndim, j, k, ninr, noutr;
|
2000-05-18 08:47:52 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (SCM_NULLP (axes))
|
|
|
|
|
|
axes = scm_cons ((SCM_ARRAYP (ra) ? SCM_MAKINUM (SCM_ARRAY_NDIM (ra) - 1) : SCM_INUM0), SCM_EOL);
|
|
|
|
|
|
ninr = scm_ilength (axes);
|
2000-05-18 08:47:52 +00:00
|
|
|
|
SCM_ASSERT (0 <= ninr, scm_makfrom0str (FUNC_NAME), SCM_WNA, NULL);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
ra_inr = scm_make_ra (ninr);
|
|
|
|
|
|
SCM_ASRTGO (SCM_NIMP (ra), badarg1);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
switch SCM_TYP7 (ra)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg1:SCM_WRONG_TYPE_ARG (1, ra);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_string:
|
|
|
|
|
|
case scm_tc7_bvect:
|
|
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
case scm_tc7_fvect:
|
|
|
|
|
|
case scm_tc7_dvect:
|
|
|
|
|
|
case scm_tc7_cvect:
|
|
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_svect:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
|
|
|
|
|
#endif
|
|
|
|
|
|
s->lbnd = 0;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
s->ubnd = SCM_INUM (scm_uniform_vector_length (ra)) - 1;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
s->inc = 1;
|
|
|
|
|
|
SCM_ARRAY_V (ra_inr) = ra;
|
|
|
|
|
|
SCM_ARRAY_BASE (ra_inr) = 0;
|
|
|
|
|
|
ndim = 1;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
SCM_ASRTGO (SCM_ARRAYP (ra), badarg1);
|
|
|
|
|
|
s = SCM_ARRAY_DIMS (ra);
|
|
|
|
|
|
SCM_ARRAY_V (ra_inr) = SCM_ARRAY_V (ra);
|
|
|
|
|
|
SCM_ARRAY_BASE (ra_inr) = SCM_ARRAY_BASE (ra);
|
|
|
|
|
|
ndim = SCM_ARRAY_NDIM (ra);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
noutr = ndim - ninr;
|
2000-03-02 20:54:43 +00:00
|
|
|
|
axv = scm_make_string (SCM_MAKINUM (ndim), SCM_MAKE_CHAR (0));
|
2000-05-18 08:47:52 +00:00
|
|
|
|
SCM_ASSERT (0 <= noutr, scm_makfrom0str (FUNC_NAME), SCM_WNA, NULL);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
res = scm_make_ra (noutr);
|
|
|
|
|
|
SCM_ARRAY_BASE (res) = SCM_ARRAY_BASE (ra_inr);
|
|
|
|
|
|
SCM_ARRAY_V (res) = ra_inr;
|
|
|
|
|
|
for (k = 0; k < ninr; k++, axes = SCM_CDR (axes))
|
|
|
|
|
|
{
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_ASSERT (SCM_INUMP (SCM_CAR (axes)), SCM_CAR (axes), "bad axis", FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
j = SCM_INUM (SCM_CAR (axes));
|
|
|
|
|
|
SCM_ARRAY_DIMS (ra_inr)[k].lbnd = s[j].lbnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (ra_inr)[k].ubnd = s[j].ubnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (ra_inr)[k].inc = s[j].inc;
|
2000-09-26 21:53:49 +00:00
|
|
|
|
SCM_STRING_CHARS (axv)[j] = 1;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
for (j = 0, k = 0; k < noutr; k++, j++)
|
|
|
|
|
|
{
|
2000-09-26 21:53:49 +00:00
|
|
|
|
while (SCM_STRING_CHARS (axv)[j])
|
1996-07-25 22:56:11 +00:00
|
|
|
|
j++;
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].lbnd = s[j].lbnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].ubnd = s[j].ubnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].inc = s[j].inc;
|
|
|
|
|
|
}
|
|
|
|
|
|
scm_ra_set_contp (ra_inr);
|
|
|
|
|
|
scm_ra_set_contp (res);
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-05-18 08:47:52 +00:00
|
|
|
|
SCM_DEFINE (scm_array_in_bounds_p, "array-in-bounds?", 1, 0, 1,
|
|
|
|
|
|
(SCM v, SCM args),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns @code{#t} if its arguments would be acceptable to array-ref.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_array_in_bounds_p
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-05-18 08:47:52 +00:00
|
|
|
|
SCM ind = SCM_EOL;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
long pos = 0;
|
|
|
|
|
|
register scm_sizet k;
|
|
|
|
|
|
register long j;
|
|
|
|
|
|
scm_array_dim *s;
|
2000-05-18 08:47:52 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ASRTGO (SCM_NIMP (v), badarg1);
|
|
|
|
|
|
if (SCM_NIMP (args))
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
ind = SCM_CAR (args);
|
|
|
|
|
|
args = SCM_CDR (args);
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_ASSERT (SCM_INUMP (ind), ind, SCM_ARG2, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
pos = SCM_INUM (ind);
|
|
|
|
|
|
}
|
|
|
|
|
|
tail:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
switch SCM_TYP7 (v)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg1:SCM_WRONG_TYPE_ARG (1, v);
|
1999-12-12 02:36:16 +00:00
|
|
|
|
wna: scm_wrong_num_args (scm_makfrom0str (FUNC_NAME));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
k = SCM_ARRAY_NDIM (v);
|
|
|
|
|
|
s = SCM_ARRAY_DIMS (v);
|
|
|
|
|
|
pos = SCM_ARRAY_BASE (v);
|
|
|
|
|
|
if (!k)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ASRTGO (SCM_NULLP (ind), wna);
|
|
|
|
|
|
ind = SCM_INUM0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
while (!0)
|
|
|
|
|
|
{
|
|
|
|
|
|
j = SCM_INUM (ind);
|
|
|
|
|
|
if (!(j >= (s->lbnd) && j <= (s->ubnd)))
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ASRTGO (--k == scm_ilength (args), wna);
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
}
|
|
|
|
|
|
pos += (j - s->lbnd) * (s->inc);
|
|
|
|
|
|
if (!(--k && SCM_NIMP (args)))
|
|
|
|
|
|
break;
|
|
|
|
|
|
ind = SCM_CAR (args);
|
|
|
|
|
|
args = SCM_CDR (args);
|
|
|
|
|
|
s++;
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_ASSERT (SCM_INUMP (ind), ind, s_bad_ind, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
SCM_ASRTGO (0 == k, wna);
|
|
|
|
|
|
v = SCM_ARRAY_V (v);
|
|
|
|
|
|
goto tail;
|
|
|
|
|
|
case scm_tc7_bvect:
|
|
|
|
|
|
case scm_tc7_string:
|
|
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
case scm_tc7_fvect:
|
|
|
|
|
|
case scm_tc7_dvect:
|
|
|
|
|
|
case scm_tc7_cvect:
|
|
|
|
|
|
case scm_tc7_svect:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
|
|
|
|
|
#endif
|
|
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
{
|
|
|
|
|
|
unsigned long int length = SCM_INUM (scm_uniform_vector_length (v));
|
|
|
|
|
|
SCM_ASRTGO (SCM_NULLP (args) && SCM_INUMP (ind), wna);
|
|
|
|
|
|
return SCM_BOOL(pos >= 0 && pos < length);
|
|
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_REGISTER_PROC(s_array_ref, "array-ref", 1, 0, 1, scm_uniform_vector_ref);
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_uniform_vector_ref, "uniform-vector-ref", 2, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM v, SCM args),
|
2000-09-02 23:15:04 +00:00
|
|
|
|
"@deffnx primitive array-ref v . args\n"
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns the element at the @code{(index1, index2)} element in @var{array}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_uniform_vector_ref
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
long pos;
|
|
|
|
|
|
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
if (SCM_IMP (v))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM_ASRTGO (SCM_NULLP (args), badarg);
|
|
|
|
|
|
return v;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (SCM_ARRAYP (v))
|
|
|
|
|
|
{
|
1999-12-12 02:36:16 +00:00
|
|
|
|
pos = scm_aind (v, args, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
v = SCM_ARRAY_V (v);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2000-10-11 12:24:43 +00:00
|
|
|
|
unsigned long int length;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (SCM_NIMP (args))
|
|
|
|
|
|
{
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_ASSERT (SCM_CONSP (args) && SCM_INUMP (SCM_CAR (args)), args, SCM_ARG2, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
pos = SCM_INUM (SCM_CAR (args));
|
|
|
|
|
|
SCM_ASRTGO (SCM_NULLP (SCM_CDR (args)), wna);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_VALIDATE_INUM (2,args);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
pos = SCM_INUM (args);
|
|
|
|
|
|
}
|
2000-10-11 12:24:43 +00:00
|
|
|
|
length = SCM_INUM (scm_uniform_vector_length (v));
|
|
|
|
|
|
SCM_ASRTGO (pos >= 0 && pos < length, outrng);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
2000-10-11 12:24:43 +00:00
|
|
|
|
switch SCM_TYP7 (v)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
|
|
|
|
|
if (SCM_NULLP (args))
|
|
|
|
|
|
return v;
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
badarg:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
SCM_WRONG_TYPE_ARG (1, v);
|
|
|
|
|
|
/* not reached */
|
2000-03-09 18:58:58 +00:00
|
|
|
|
|
|
|
|
|
|
outrng:
|
|
|
|
|
|
scm_out_of_range (FUNC_NAME, SCM_MAKINUM (pos));
|
|
|
|
|
|
wna:
|
|
|
|
|
|
scm_wrong_num_args (SCM_FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
{ /* enclosed */
|
|
|
|
|
|
int k = SCM_ARRAY_NDIM (v);
|
|
|
|
|
|
SCM res = scm_make_ra (k);
|
|
|
|
|
|
SCM_ARRAY_V (res) = SCM_ARRAY_V (v);
|
|
|
|
|
|
SCM_ARRAY_BASE (res) = pos;
|
|
|
|
|
|
while (k--)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].lbnd = SCM_ARRAY_DIMS (v)[k].lbnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].ubnd = SCM_ARRAY_DIMS (v)[k].ubnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].inc = SCM_ARRAY_DIMS (v)[k].inc;
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
case scm_tc7_bvect:
|
2000-03-09 18:58:58 +00:00
|
|
|
|
if (SCM_BITVEC_REF (v, pos))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_BOOL_T;
|
|
|
|
|
|
else
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
case scm_tc7_string:
|
2000-09-26 22:15:13 +00:00
|
|
|
|
return SCM_MAKE_CHAR (SCM_STRING_UCHARS (v)[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_byvect:
|
2000-09-26 21:53:49 +00:00
|
|
|
|
return SCM_MAKINUM (((char *) SCM_UVECTOR_BASE (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_uvect:
|
2000-04-18 14:12:07 +00:00
|
|
|
|
return scm_ulong2num (((unsigned long *) SCM_VELTS (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_ivect:
|
2000-04-18 14:12:07 +00:00
|
|
|
|
return scm_long2num(((signed long *) SCM_VELTS (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
case scm_tc7_svect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return SCM_MAKINUM (((short *) SCM_CELL_WORD_1 (v))[pos]);
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return scm_long_long2num (((long_long *) SCM_CELL_WORD_1 (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
case scm_tc7_fvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return scm_make_real (((float *) SCM_CELL_WORD_1 (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_dvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return scm_make_real (((double *) SCM_CELL_WORD_1 (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_cvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return scm_make_complex (((double *) SCM_CELL_WORD_1 (v))[2 * pos],
|
|
|
|
|
|
((double *) SCM_CELL_WORD_1 (v))[2 * pos + 1]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_VELTS (v)[pos];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
/* Internal version of scm_uniform_vector_ref for uves that does no error checking and
|
|
|
|
|
|
tries to recycle conses. (Make *sure* you want them recycled.) */
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
1999-12-12 20:35:02 +00:00
|
|
|
|
scm_cvref (SCM v, scm_sizet pos, SCM last)
|
2001-03-04 17:09:34 +00:00
|
|
|
|
#define FUNC_NAME "scm_cvref"
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
switch SCM_TYP7 (v)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 17:09:34 +00:00
|
|
|
|
SCM_WRONG_TYPE_ARG (SCM_ARG1, v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_bvect:
|
2000-03-09 18:58:58 +00:00
|
|
|
|
if (SCM_BITVEC_REF(v,pos))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_BOOL_T;
|
|
|
|
|
|
else
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
case scm_tc7_string:
|
2000-09-26 22:15:13 +00:00
|
|
|
|
return SCM_MAKE_CHAR (SCM_STRING_UCHARS (v)[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_byvect:
|
2000-09-26 21:53:49 +00:00
|
|
|
|
return SCM_MAKINUM (((char *) SCM_UVECTOR_BASE (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_uvect:
|
2000-04-18 14:12:07 +00:00
|
|
|
|
return scm_ulong2num(((unsigned long *) SCM_VELTS (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_ivect:
|
2000-04-18 14:12:07 +00:00
|
|
|
|
return scm_long2num(((signed long *) SCM_VELTS (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_svect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return SCM_MAKINUM (((short *) SCM_CELL_WORD_1 (v))[pos]);
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return scm_long_long2num (((long_long *) SCM_CELL_WORD_1 (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
case scm_tc7_fvect:
|
2000-04-18 14:12:07 +00:00
|
|
|
|
if (SCM_NIMP (last) && !SCM_EQ_P (last, scm_flo0) && SCM_SLOPPY_REALP (last))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-04-04 12:13:41 +00:00
|
|
|
|
SCM_REAL_VALUE (last) = ((float *) SCM_CELL_WORD_1 (v))[pos];
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return last;
|
|
|
|
|
|
}
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return scm_make_real (((float *) SCM_CELL_WORD_1 (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_dvect:
|
2000-04-18 14:12:07 +00:00
|
|
|
|
if (SCM_NIMP (last) && !SCM_EQ_P (last, scm_flo0) && SCM_SLOPPY_REALP (last))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-04-04 12:13:41 +00:00
|
|
|
|
SCM_REAL_VALUE (last) = ((double *) SCM_CELL_WORD_1 (v))[pos];
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return last;
|
|
|
|
|
|
}
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return scm_make_real (((double *) SCM_CELL_WORD_1 (v))[pos]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_cvect:
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
if (SCM_NIMP (last) && SCM_SLOPPY_COMPLEXP (last))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-04-04 12:13:41 +00:00
|
|
|
|
SCM_COMPLEX_REAL (last) = ((double *) SCM_CELL_WORD_1 (v))[2 * pos];
|
|
|
|
|
|
SCM_COMPLEX_IMAG (last) = ((double *) SCM_CELL_WORD_1 (v))[2 * pos + 1];
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return last;
|
|
|
|
|
|
}
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return scm_make_complex (((double *) SCM_CELL_WORD_1 (v))[2 * pos],
|
|
|
|
|
|
((double *) SCM_CELL_WORD_1 (v))[2 * pos + 1]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_VELTS (v)[pos];
|
|
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
{ /* enclosed scm_array */
|
|
|
|
|
|
int k = SCM_ARRAY_NDIM (v);
|
|
|
|
|
|
SCM res = scm_make_ra (k);
|
|
|
|
|
|
SCM_ARRAY_V (res) = SCM_ARRAY_V (v);
|
|
|
|
|
|
SCM_ARRAY_BASE (res) = pos;
|
|
|
|
|
|
while (k--)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].ubnd = SCM_ARRAY_DIMS (v)[k].ubnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].lbnd = SCM_ARRAY_DIMS (v)[k].lbnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (res)[k].inc = SCM_ARRAY_DIMS (v)[k].inc;
|
|
|
|
|
|
}
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2001-03-04 17:09:34 +00:00
|
|
|
|
#undef FUNC_NAME
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_REGISTER_PROC(s_uniform_array_set1_x, "uniform-array-set1!", 3, 0, 0, scm_array_set_x);
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1997-02-15 18:49:59 +00:00
|
|
|
|
/* Note that args may be a list or an immediate object, depending which
|
|
|
|
|
|
PROC is used (and it's called from C too). */
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_array_set_x, "array-set!", 2, 0, 1,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM v, SCM obj, SCM args),
|
2000-09-02 23:15:04 +00:00
|
|
|
|
"@deffnx primitive uniform-array-set1! v obj args\n"
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Sets the element at the @code{(index1, index2)} element in @var{array} to\n"
|
|
|
|
|
|
"@var{new-value}. The value returned by array-set! is unspecified.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_array_set_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
1998-10-15 14:35:35 +00:00
|
|
|
|
long pos = 0;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ASRTGO (SCM_NIMP (v), badarg1);
|
|
|
|
|
|
if (SCM_ARRAYP (v))
|
|
|
|
|
|
{
|
1999-12-12 02:36:16 +00:00
|
|
|
|
pos = scm_aind (v, args, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
v = SCM_ARRAY_V (v);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2000-10-11 12:24:43 +00:00
|
|
|
|
unsigned long int length;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (SCM_NIMP (args))
|
|
|
|
|
|
{
|
1997-02-15 18:49:59 +00:00
|
|
|
|
SCM_ASSERT (SCM_CONSP(args) && SCM_INUMP (SCM_CAR (args)), args,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_ARG3, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ASRTGO (SCM_NULLP (SCM_CDR (args)), wna);
|
1997-02-15 18:49:59 +00:00
|
|
|
|
pos = SCM_INUM (SCM_CAR (args));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_VALIDATE_INUM_COPY (3,args,pos);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
2000-10-11 12:24:43 +00:00
|
|
|
|
length = SCM_INUM (scm_uniform_vector_length (v));
|
|
|
|
|
|
SCM_ASRTGO (pos >= 0 && pos < length, outrng);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
switch (SCM_TYP7 (v))
|
|
|
|
|
|
{
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
default: badarg1:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
SCM_WRONG_TYPE_ARG (1, v);
|
|
|
|
|
|
/* not reached */
|
2000-03-09 18:58:58 +00:00
|
|
|
|
outrng:
|
|
|
|
|
|
scm_out_of_range (FUNC_NAME, SCM_MAKINUM (pos));
|
|
|
|
|
|
wna:
|
|
|
|
|
|
scm_wrong_num_args (SCM_FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_smob: /* enclosed */
|
|
|
|
|
|
goto badarg1;
|
|
|
|
|
|
case scm_tc7_bvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
if (SCM_FALSEP (obj))
|
2000-03-09 18:58:58 +00:00
|
|
|
|
SCM_BITVEC_CLR(v,pos);
|
2000-06-05 11:39:46 +00:00
|
|
|
|
else if (SCM_EQ_P (obj, SCM_BOOL_T))
|
2000-03-09 18:58:58 +00:00
|
|
|
|
SCM_BITVEC_SET(v,pos);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
else
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badobj:SCM_WRONG_TYPE_ARG (2, obj);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_string:
|
2000-03-02 20:54:43 +00:00
|
|
|
|
SCM_ASRTGO (SCM_CHARP (obj), badobj);
|
2000-09-26 22:15:13 +00:00
|
|
|
|
SCM_STRING_UCHARS (v)[pos] = SCM_CHAR (obj);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_byvect:
|
2000-03-02 20:54:43 +00:00
|
|
|
|
if (SCM_CHARP (obj))
|
|
|
|
|
|
obj = SCM_MAKINUM ((char) SCM_CHAR (obj));
|
1997-02-15 18:49:59 +00:00
|
|
|
|
SCM_ASRTGO (SCM_INUMP (obj), badobj);
|
2000-09-26 21:53:49 +00:00
|
|
|
|
((char *) SCM_UVECTOR_BASE (v))[pos] = SCM_INUM (obj);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
1999-12-12 02:36:16 +00:00
|
|
|
|
case scm_tc7_uvect:
|
2000-03-12 18:30:33 +00:00
|
|
|
|
SCM_VELTS(v)[pos] = SCM_PACK (scm_num2ulong(obj, (char *)SCM_ARG2, FUNC_NAME));
|
2000-03-09 18:58:58 +00:00
|
|
|
|
break;
|
1999-12-12 02:36:16 +00:00
|
|
|
|
case scm_tc7_ivect:
|
2000-03-12 18:30:33 +00:00
|
|
|
|
SCM_VELTS(v)[pos] = SCM_PACK (scm_num2long(obj, (char *)SCM_ARG2, FUNC_NAME));
|
2000-03-09 18:58:58 +00:00
|
|
|
|
break;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_svect:
|
1997-02-15 18:49:59 +00:00
|
|
|
|
SCM_ASRTGO (SCM_INUMP (obj), badobj);
|
2000-04-04 12:13:41 +00:00
|
|
|
|
((short *) SCM_CELL_WORD_1 (v))[pos] = SCM_INUM (obj);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
((long_long *) SCM_CELL_WORD_1 (v))[pos] = scm_num2long_long (obj, (char *)SCM_ARG2, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case scm_tc7_fvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
((float *) SCM_CELL_WORD_1 (v))[pos] = (float) scm_num2dbl (obj, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_dvect:
|
2000-04-04 12:13:41 +00:00
|
|
|
|
((double *) SCM_CELL_WORD_1 (v))[pos] = scm_num2dbl (obj, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_cvect:
|
2000-05-10 12:34:43 +00:00
|
|
|
|
SCM_ASRTGO (SCM_INEXACTP (obj), badobj);
|
|
|
|
|
|
if (SCM_REALP (obj)) {
|
|
|
|
|
|
((double *) SCM_CELL_WORD_1 (v))[2 * pos] = SCM_REAL_VALUE (obj);
|
|
|
|
|
|
((double *) SCM_CELL_WORD_1 (v))[2 * pos + 1] = 0.0;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
((double *) SCM_CELL_WORD_1 (v))[2 * pos] = SCM_COMPLEX_REAL (obj);
|
|
|
|
|
|
((double *) SCM_CELL_WORD_1 (v))[2 * pos + 1] = SCM_COMPLEX_IMAG (obj);
|
|
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_VELTS (v)[pos] = obj;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
1999-11-30 18:23:52 +00:00
|
|
|
|
/* attempts to unroll an array into a one-dimensional array.
|
|
|
|
|
|
returns the unrolled array or #f if it can't be done. */
|
1999-12-12 02:36:16 +00:00
|
|
|
|
/* if strict is not SCM_UNDEFINED, return #f if returned array
|
1999-11-30 18:23:52 +00:00
|
|
|
|
wouldn't have contiguous elements. */
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM ra, SCM strict),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"@deffnx primitive array-contents array strict\n"
|
|
|
|
|
|
"If @var{array} may be @dfn{unrolled} into a one dimensional shared array\n"
|
|
|
|
|
|
"without changing their order (last subscript changing fastest), then\n"
|
|
|
|
|
|
"@code{array-contents} returns that shared array, otherwise it returns\n"
|
|
|
|
|
|
"@code{#f}. All arrays made by @var{make-array} and\n"
|
|
|
|
|
|
"@var{make-uniform-array} may be unrolled, some arrays made by\n"
|
|
|
|
|
|
"@var{make-shared-array} may not be.\n\n"
|
|
|
|
|
|
"If the optional argument @var{strict} is provided, a shared array will\n"
|
|
|
|
|
|
"be returned only if its elements are stored internally contiguous in\n"
|
|
|
|
|
|
"memory.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_array_contents
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM sra;
|
|
|
|
|
|
if (SCM_IMP (ra))
|
1998-10-15 14:35:35 +00:00
|
|
|
|
return SCM_BOOL_F;
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
switch SCM_TYP7 (ra)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_string:
|
|
|
|
|
|
case scm_tc7_bvect:
|
|
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
case scm_tc7_fvect:
|
|
|
|
|
|
case scm_tc7_dvect:
|
|
|
|
|
|
case scm_tc7_cvect:
|
|
|
|
|
|
case scm_tc7_svect:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
|
|
|
|
|
#endif
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_sizet k, ndim = SCM_ARRAY_NDIM (ra), len = 1;
|
|
|
|
|
|
if (!SCM_ARRAYP (ra) || !SCM_ARRAY_CONTP (ra))
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
for (k = 0; k < ndim; k++)
|
|
|
|
|
|
len *= SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd + 1;
|
|
|
|
|
|
if (!SCM_UNBNDP (strict))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ndim && (1 != SCM_ARRAY_DIMS (ra)[ndim - 1].inc))
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
if (scm_tc7_bvect == SCM_TYP7 (SCM_ARRAY_V (ra)))
|
|
|
|
|
|
{
|
2000-10-11 12:24:43 +00:00
|
|
|
|
if (len != SCM_BITVECTOR_LENGTH (SCM_ARRAY_V (ra)) ||
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ARRAY_BASE (ra) % SCM_LONG_BIT ||
|
|
|
|
|
|
len % SCM_LONG_BIT)
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2000-10-11 12:24:43 +00:00
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM v = SCM_ARRAY_V (ra);
|
|
|
|
|
|
unsigned long int length = SCM_INUM (scm_uniform_vector_length (v));
|
|
|
|
|
|
if ((len == length) && 0 == SCM_ARRAY_BASE (ra) && SCM_ARRAY_DIMS (ra)->inc)
|
|
|
|
|
|
return v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sra = scm_make_ra (1);
|
|
|
|
|
|
SCM_ARRAY_DIMS (sra)->lbnd = 0;
|
|
|
|
|
|
SCM_ARRAY_DIMS (sra)->ubnd = len - 1;
|
|
|
|
|
|
SCM_ARRAY_V (sra) = SCM_ARRAY_V (ra);
|
|
|
|
|
|
SCM_ARRAY_BASE (sra) = SCM_ARRAY_BASE (ra);
|
|
|
|
|
|
SCM_ARRAY_DIMS (sra)->inc = (ndim ? SCM_ARRAY_DIMS (ra)[ndim - 1].inc : 1);
|
|
|
|
|
|
return sra;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM
|
1999-12-12 20:35:02 +00:00
|
|
|
|
scm_ra2contig (SCM ra, int copy)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM ret;
|
|
|
|
|
|
long inc = 1;
|
|
|
|
|
|
scm_sizet k, len = 1;
|
|
|
|
|
|
for (k = SCM_ARRAY_NDIM (ra); k--;)
|
|
|
|
|
|
len *= SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd + 1;
|
|
|
|
|
|
k = SCM_ARRAY_NDIM (ra);
|
|
|
|
|
|
if (SCM_ARRAY_CONTP (ra) && ((0 == k) || (1 == SCM_ARRAY_DIMS (ra)[k - 1].inc)))
|
|
|
|
|
|
{
|
2000-10-11 12:24:43 +00:00
|
|
|
|
if (scm_tc7_bvect != SCM_TYP7 (SCM_ARRAY_V (ra)))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return ra;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
if ((len == SCM_BITVECTOR_LENGTH (SCM_ARRAY_V (ra)) &&
|
1996-07-25 22:56:11 +00:00
|
|
|
|
0 == SCM_ARRAY_BASE (ra) % SCM_LONG_BIT &&
|
|
|
|
|
|
0 == len % SCM_LONG_BIT))
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
}
|
|
|
|
|
|
ret = scm_make_ra (k);
|
|
|
|
|
|
SCM_ARRAY_BASE (ret) = 0;
|
|
|
|
|
|
while (k--)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ARRAY_DIMS (ret)[k].lbnd = SCM_ARRAY_DIMS (ra)[k].lbnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (ret)[k].ubnd = SCM_ARRAY_DIMS (ra)[k].ubnd;
|
|
|
|
|
|
SCM_ARRAY_DIMS (ret)[k].inc = inc;
|
|
|
|
|
|
inc *= SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd + 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
SCM_ARRAY_V (ret) = scm_make_uve ((inc - 1), scm_array_prototype (ra));
|
|
|
|
|
|
if (copy)
|
|
|
|
|
|
scm_array_copy_x (ra, ret);
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_uniform_array_read_x, "uniform-array-read!", 1, 3, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM ra, SCM port_or_fd, SCM start, SCM end),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"@deffnx primitive uniform-vector-read! uve [port-or-fdes] [start] [end]\n"
|
|
|
|
|
|
"Attempts to read all elements of @var{ura}, in lexicographic order, as\n"
|
|
|
|
|
|
"binary objects from @var{port-or-fdes}.\n"
|
|
|
|
|
|
"If an end of file is encountered during\n"
|
|
|
|
|
|
"uniform-array-read! the objects up to that point only are put into @var{ura}\n"
|
|
|
|
|
|
"(starting at the beginning) and the remainder of the array is\n"
|
|
|
|
|
|
"unchanged.\n\n"
|
|
|
|
|
|
"The optional arguments @var{start} and @var{end} allow\n"
|
|
|
|
|
|
"a specified region of a vector (or linearized array) to be read,\n"
|
|
|
|
|
|
"leaving the remainder of the vector unchanged.\n\n"
|
|
|
|
|
|
"@code{uniform-array-read!} returns the number of objects read.\n"
|
|
|
|
|
|
"@var{port-or-fdes} may be omitted, in which case it defaults to the value\n"
|
|
|
|
|
|
"returned by @code{(current-input-port)}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_uniform_array_read_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
SCM cra = SCM_UNDEFINED, v = ra;
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
long sz, vlen, ans;
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
long cstart = 0;
|
|
|
|
|
|
long cend;
|
|
|
|
|
|
long offset = 0;
|
2000-09-26 21:53:49 +00:00
|
|
|
|
char *base;
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ASRTGO (SCM_NIMP (v), badarg1);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
if (SCM_UNBNDP (port_or_fd))
|
|
|
|
|
|
port_or_fd = scm_cur_inp;
|
|
|
|
|
|
else
|
|
|
|
|
|
SCM_ASSERT (SCM_INUMP (port_or_fd)
|
1999-12-16 20:48:05 +00:00
|
|
|
|
|| (SCM_OPINPORTP (port_or_fd)),
|
1999-12-12 02:36:16 +00:00
|
|
|
|
port_or_fd, SCM_ARG2, FUNC_NAME);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
vlen = SCM_INUM (scm_uniform_vector_length (v));
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
loop:
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
switch SCM_TYP7 (v)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg1:SCM_WRONG_TYPE_ARG (SCM_ARG1, v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
SCM_ASRTGO (SCM_ARRAYP (v), badarg1);
|
|
|
|
|
|
cra = scm_ra2contig (ra, 0);
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
cstart += SCM_ARRAY_BASE (cra);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
vlen = SCM_ARRAY_DIMS (cra)->inc *
|
1996-07-25 22:56:11 +00:00
|
|
|
|
(SCM_ARRAY_DIMS (cra)->ubnd - SCM_ARRAY_DIMS (cra)->lbnd + 1);
|
|
|
|
|
|
v = SCM_ARRAY_V (cra);
|
|
|
|
|
|
goto loop;
|
|
|
|
|
|
case scm_tc7_string:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = SCM_STRING_CHARS (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (char);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_bvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_BITVECTOR_BASE (v);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
vlen = (vlen + SCM_LONG_BIT - 1) / SCM_LONG_BIT;
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
cstart /= SCM_LONG_BIT;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
sz = sizeof (long);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
|
|
|
|
|
sz = sizeof (char);
|
|
|
|
|
|
break;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (long);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_svect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (short);
|
|
|
|
|
|
break;
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (long_long);
|
|
|
|
|
|
break;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
case scm_tc7_fvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (float);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_dvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (double);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_cvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = 2 * sizeof (double);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2000-09-26 21:53:49 +00:00
|
|
|
|
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
cend = vlen;
|
|
|
|
|
|
if (!SCM_UNBNDP (start))
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
{
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
offset =
|
1999-12-18 23:24:35 +00:00
|
|
|
|
SCM_NUM2LONG (3, start);
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
if (offset < 0 || offset >= cend)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_out_of_range (FUNC_NAME, start);
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
|
|
|
|
|
|
if (!SCM_UNBNDP (end))
|
|
|
|
|
|
{
|
|
|
|
|
|
long tend =
|
1999-12-18 23:24:35 +00:00
|
|
|
|
SCM_NUM2LONG (4, end);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
if (tend <= offset || tend > cend)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_out_of_range (FUNC_NAME, end);
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
cend = tend;
|
|
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
if (SCM_NIMP (port_or_fd))
|
|
|
|
|
|
{
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* strports.c (scm_strprint_obj): bug fix: get pt from the port,
not from the parameter obj. (Thanks to Eric Moore.)
* ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET,
SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted.
* strings.c (scm_make_string): throw error if 2nd arg isn't
a char.
* unif.c (scm_uniform_array_read_x): fix reading from a port.
allow non-fports.
(scm_uniform_array_write): likewise.
1999-06-29 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_drain_input): rewritten.
* fports.c (local_fclose): check putback_buf.
(local_read_flush): likewise.
* ports.c (scm_remove_from_port_table): maybe free putback_buf.
* ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/
putback_buf_size.
(SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE.
* ports.c (scm_grow_port_cbuf): deleted.
(scm_add_to_port_table): initialise putback_buf to 0. remove cbuf
stuff.
(scm_char_ready_p): check putback_buf
(scm_fill_buffer): likewise.
(scm_ungetc): rewritten.
1999-06-27 Gary Houston <ghouston@easynet.co.uk>
* fports.c (local_fclose): account for push-back buffer.
* ports.c (scm_char_ready_p): check the push-back buffer in
a new way.
* ioext.c (scm_do_read_line): remove the extra code to handle
the push-back buffer.
* ports.c (scm_getc): don't use SCM_CRDYP etc.
* ioext.c (scm_do_read_line): call scm_fill_buffer.
* ports.c (scm_ungetc): don't call SCM_CUNGET. reset the
read buffer pointers.
scm_fill_buffer: new procedure.
(scm_getc): call scm_fill_buffer.
* ports.h (struct scm_port): saved_read_buf, saved_read_pos,
saved_read_end: new fields.
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* configure.in: don't check for ways to violate stdio abstraction.
1999-07-04 11:02:21 +00:00
|
|
|
|
scm_port *pt = SCM_PTAB_ENTRY (port_or_fd);
|
|
|
|
|
|
int remaining = (cend - offset) * sz;
|
2000-09-26 21:53:49 +00:00
|
|
|
|
char *dest = base + (cstart + offset) * sz;
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* strports.c (scm_strprint_obj): bug fix: get pt from the port,
not from the parameter obj. (Thanks to Eric Moore.)
* ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET,
SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted.
* strings.c (scm_make_string): throw error if 2nd arg isn't
a char.
* unif.c (scm_uniform_array_read_x): fix reading from a port.
allow non-fports.
(scm_uniform_array_write): likewise.
1999-06-29 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_drain_input): rewritten.
* fports.c (local_fclose): check putback_buf.
(local_read_flush): likewise.
* ports.c (scm_remove_from_port_table): maybe free putback_buf.
* ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/
putback_buf_size.
(SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE.
* ports.c (scm_grow_port_cbuf): deleted.
(scm_add_to_port_table): initialise putback_buf to 0. remove cbuf
stuff.
(scm_char_ready_p): check putback_buf
(scm_fill_buffer): likewise.
(scm_ungetc): rewritten.
1999-06-27 Gary Houston <ghouston@easynet.co.uk>
* fports.c (local_fclose): account for push-back buffer.
* ports.c (scm_char_ready_p): check the push-back buffer in
a new way.
* ioext.c (scm_do_read_line): remove the extra code to handle
the push-back buffer.
* ports.c (scm_getc): don't use SCM_CRDYP etc.
* ioext.c (scm_do_read_line): call scm_fill_buffer.
* ports.c (scm_ungetc): don't call SCM_CUNGET. reset the
read buffer pointers.
scm_fill_buffer: new procedure.
(scm_getc): call scm_fill_buffer.
* ports.h (struct scm_port): saved_read_buf, saved_read_pos,
saved_read_end: new fields.
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* configure.in: don't check for ways to violate stdio abstraction.
1999-07-04 11:02:21 +00:00
|
|
|
|
|
|
|
|
|
|
if (pt->rw_active == SCM_PORT_WRITE)
|
1999-08-11 Gary Houston <ghouston@easynet.co.uk>
* fports.c (fport_input_waiting): if select is used, return 1
instead of whatever FD_ISSET expands to. maybe it will be useful
to interpret the value from the input_waiting ptob procedure as a
lower bound on the number of bytes available.
* Mikael asked for a few names to be changed...
* ports.c (scm_make_port_type): take the write procedure as the
second argument instead of the flush procedure.
* ports.h (scm_ptob_descriptor): rename the ptob procedures:
fflush -> flush, read_flush -> end_input, fclose -> close,
fill_buffer -> fill_input, ftruncate -> truncate,
input_waiting_p -> input_waiting.
* ports.c (end_input_void_port): was read_flush_void_port.
(scm_set_port_end_input): was scm_set_port_flush_input.
(scm_set_port_flush): was scm_set_port_write.
(scm_set_port_input_waiting): was scm_set_port_input_waiting_p
(scm_end_input): was scm_read_flush.
(scm_fill_input): was scm_fill_buffer.
(scm_flush): was scm_fflush.
* fports.c (fport_input_waiting): renamed from fport_input_waiting_p.
(fport_end_input): was local_read_flush.
(fport_flush): was local_fflush.
(fport_close): was local_fclose.
(fport_truncate): was local_ftruncate.
(fport_seek): was local_seek.
(fport_free): was local_free.
(fport_fill_input): was fport_fill_buffer.
* strports.c (st_end_input): was st_read_flush.
(st_truncate): was st_ftruncate.
* vports.c: (sf_flush): was sfflush.
(sf_close): was sfclose.
(sf_fill_input): was sf_fill_buffer.
* ports.c, fports.c, strports, vports.c, ioext.c, unif.c, filesys.c:
change callers.
1999-08-11 18:35:42 +00:00
|
|
|
|
scm_flush (port_or_fd);
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* strports.c (scm_strprint_obj): bug fix: get pt from the port,
not from the parameter obj. (Thanks to Eric Moore.)
* ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET,
SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted.
* strings.c (scm_make_string): throw error if 2nd arg isn't
a char.
* unif.c (scm_uniform_array_read_x): fix reading from a port.
allow non-fports.
(scm_uniform_array_write): likewise.
1999-06-29 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_drain_input): rewritten.
* fports.c (local_fclose): check putback_buf.
(local_read_flush): likewise.
* ports.c (scm_remove_from_port_table): maybe free putback_buf.
* ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/
putback_buf_size.
(SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE.
* ports.c (scm_grow_port_cbuf): deleted.
(scm_add_to_port_table): initialise putback_buf to 0. remove cbuf
stuff.
(scm_char_ready_p): check putback_buf
(scm_fill_buffer): likewise.
(scm_ungetc): rewritten.
1999-06-27 Gary Houston <ghouston@easynet.co.uk>
* fports.c (local_fclose): account for push-back buffer.
* ports.c (scm_char_ready_p): check the push-back buffer in
a new way.
* ioext.c (scm_do_read_line): remove the extra code to handle
the push-back buffer.
* ports.c (scm_getc): don't use SCM_CRDYP etc.
* ioext.c (scm_do_read_line): call scm_fill_buffer.
* ports.c (scm_ungetc): don't call SCM_CUNGET. reset the
read buffer pointers.
scm_fill_buffer: new procedure.
(scm_getc): call scm_fill_buffer.
* ports.h (struct scm_port): saved_read_buf, saved_read_pos,
saved_read_end: new fields.
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* configure.in: don't check for ways to violate stdio abstraction.
1999-07-04 11:02:21 +00:00
|
|
|
|
|
|
|
|
|
|
ans = cend - offset;
|
|
|
|
|
|
while (remaining > 0)
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
{
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* strports.c (scm_strprint_obj): bug fix: get pt from the port,
not from the parameter obj. (Thanks to Eric Moore.)
* ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET,
SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted.
* strings.c (scm_make_string): throw error if 2nd arg isn't
a char.
* unif.c (scm_uniform_array_read_x): fix reading from a port.
allow non-fports.
(scm_uniform_array_write): likewise.
1999-06-29 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_drain_input): rewritten.
* fports.c (local_fclose): check putback_buf.
(local_read_flush): likewise.
* ports.c (scm_remove_from_port_table): maybe free putback_buf.
* ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/
putback_buf_size.
(SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE.
* ports.c (scm_grow_port_cbuf): deleted.
(scm_add_to_port_table): initialise putback_buf to 0. remove cbuf
stuff.
(scm_char_ready_p): check putback_buf
(scm_fill_buffer): likewise.
(scm_ungetc): rewritten.
1999-06-27 Gary Houston <ghouston@easynet.co.uk>
* fports.c (local_fclose): account for push-back buffer.
* ports.c (scm_char_ready_p): check the push-back buffer in
a new way.
* ioext.c (scm_do_read_line): remove the extra code to handle
the push-back buffer.
* ports.c (scm_getc): don't use SCM_CRDYP etc.
* ioext.c (scm_do_read_line): call scm_fill_buffer.
* ports.c (scm_ungetc): don't call SCM_CUNGET. reset the
read buffer pointers.
scm_fill_buffer: new procedure.
(scm_getc): call scm_fill_buffer.
* ports.h (struct scm_port): saved_read_buf, saved_read_pos,
saved_read_end: new fields.
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* configure.in: don't check for ways to violate stdio abstraction.
1999-07-04 11:02:21 +00:00
|
|
|
|
if (pt->read_pos < pt->read_end)
|
|
|
|
|
|
{
|
|
|
|
|
|
int to_copy = min (pt->read_end - pt->read_pos,
|
|
|
|
|
|
remaining);
|
|
|
|
|
|
|
|
|
|
|
|
memcpy (dest, pt->read_pos, to_copy);
|
|
|
|
|
|
pt->read_pos += to_copy;
|
|
|
|
|
|
remaining -= to_copy;
|
|
|
|
|
|
dest += to_copy;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
1999-08-11 Gary Houston <ghouston@easynet.co.uk>
* fports.c (fport_input_waiting): if select is used, return 1
instead of whatever FD_ISSET expands to. maybe it will be useful
to interpret the value from the input_waiting ptob procedure as a
lower bound on the number of bytes available.
* Mikael asked for a few names to be changed...
* ports.c (scm_make_port_type): take the write procedure as the
second argument instead of the flush procedure.
* ports.h (scm_ptob_descriptor): rename the ptob procedures:
fflush -> flush, read_flush -> end_input, fclose -> close,
fill_buffer -> fill_input, ftruncate -> truncate,
input_waiting_p -> input_waiting.
* ports.c (end_input_void_port): was read_flush_void_port.
(scm_set_port_end_input): was scm_set_port_flush_input.
(scm_set_port_flush): was scm_set_port_write.
(scm_set_port_input_waiting): was scm_set_port_input_waiting_p
(scm_end_input): was scm_read_flush.
(scm_fill_input): was scm_fill_buffer.
(scm_flush): was scm_fflush.
* fports.c (fport_input_waiting): renamed from fport_input_waiting_p.
(fport_end_input): was local_read_flush.
(fport_flush): was local_fflush.
(fport_close): was local_fclose.
(fport_truncate): was local_ftruncate.
(fport_seek): was local_seek.
(fport_free): was local_free.
(fport_fill_input): was fport_fill_buffer.
* strports.c (st_end_input): was st_read_flush.
(st_truncate): was st_ftruncate.
* vports.c: (sf_flush): was sfflush.
(sf_close): was sfclose.
(sf_fill_input): was sf_fill_buffer.
* ports.c, fports.c, strports, vports.c, ioext.c, unif.c, filesys.c:
change callers.
1999-08-11 18:35:42 +00:00
|
|
|
|
if (scm_fill_input (port_or_fd) == EOF)
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* strports.c (scm_strprint_obj): bug fix: get pt from the port,
not from the parameter obj. (Thanks to Eric Moore.)
* ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET,
SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted.
* strings.c (scm_make_string): throw error if 2nd arg isn't
a char.
* unif.c (scm_uniform_array_read_x): fix reading from a port.
allow non-fports.
(scm_uniform_array_write): likewise.
1999-06-29 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_drain_input): rewritten.
* fports.c (local_fclose): check putback_buf.
(local_read_flush): likewise.
* ports.c (scm_remove_from_port_table): maybe free putback_buf.
* ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/
putback_buf_size.
(SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE.
* ports.c (scm_grow_port_cbuf): deleted.
(scm_add_to_port_table): initialise putback_buf to 0. remove cbuf
stuff.
(scm_char_ready_p): check putback_buf
(scm_fill_buffer): likewise.
(scm_ungetc): rewritten.
1999-06-27 Gary Houston <ghouston@easynet.co.uk>
* fports.c (local_fclose): account for push-back buffer.
* ports.c (scm_char_ready_p): check the push-back buffer in
a new way.
* ioext.c (scm_do_read_line): remove the extra code to handle
the push-back buffer.
* ports.c (scm_getc): don't use SCM_CRDYP etc.
* ioext.c (scm_do_read_line): call scm_fill_buffer.
* ports.c (scm_ungetc): don't call SCM_CUNGET. reset the
read buffer pointers.
scm_fill_buffer: new procedure.
(scm_getc): call scm_fill_buffer.
* ports.h (struct scm_port): saved_read_buf, saved_read_pos,
saved_read_end: new fields.
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* configure.in: don't check for ways to violate stdio abstraction.
1999-07-04 11:02:21 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (remaining % sz != 0)
|
|
|
|
|
|
{
|
* dynl.c, feature.c, filesys.c, fports.c, list.c, load.c,
net_db.c, sort.c, stacks.c, unif.c: Use SCM_WTA, SCM_MISC_ERROR
where possible.
* symbols.c (scm_sysintern0): Fixed the function name in a
scm_misc_error invocation.
* print.c (scm_simple_format): Do not need SCM_COERCE_SUBSTR, and
use scm_return_first to ward off latent GC bug that Mikael caught.
* async.c: Use SCM_VALIDATE_ASYNC_COPY one place where it wasn't
used before but should've been.
2000-01-11 23:56:47 +00:00
|
|
|
|
SCM_MISC_ERROR ("unexpected EOF", SCM_EOL);
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* strports.c (scm_strprint_obj): bug fix: get pt from the port,
not from the parameter obj. (Thanks to Eric Moore.)
* ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET,
SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted.
* strings.c (scm_make_string): throw error if 2nd arg isn't
a char.
* unif.c (scm_uniform_array_read_x): fix reading from a port.
allow non-fports.
(scm_uniform_array_write): likewise.
1999-06-29 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_drain_input): rewritten.
* fports.c (local_fclose): check putback_buf.
(local_read_flush): likewise.
* ports.c (scm_remove_from_port_table): maybe free putback_buf.
* ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/
putback_buf_size.
(SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE.
* ports.c (scm_grow_port_cbuf): deleted.
(scm_add_to_port_table): initialise putback_buf to 0. remove cbuf
stuff.
(scm_char_ready_p): check putback_buf
(scm_fill_buffer): likewise.
(scm_ungetc): rewritten.
1999-06-27 Gary Houston <ghouston@easynet.co.uk>
* fports.c (local_fclose): account for push-back buffer.
* ports.c (scm_char_ready_p): check the push-back buffer in
a new way.
* ioext.c (scm_do_read_line): remove the extra code to handle
the push-back buffer.
* ports.c (scm_getc): don't use SCM_CRDYP etc.
* ioext.c (scm_do_read_line): call scm_fill_buffer.
* ports.c (scm_ungetc): don't call SCM_CUNGET. reset the
read buffer pointers.
scm_fill_buffer: new procedure.
(scm_getc): call scm_fill_buffer.
* ports.h (struct scm_port): saved_read_buf, saved_read_pos,
saved_read_end: new fields.
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* configure.in: don't check for ways to violate stdio abstraction.
1999-07-04 11:02:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
ans -= remaining / sz;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
}
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* strports.c (scm_strprint_obj): bug fix: get pt from the port,
not from the parameter obj. (Thanks to Eric Moore.)
* ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET,
SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted.
* strings.c (scm_make_string): throw error if 2nd arg isn't
a char.
* unif.c (scm_uniform_array_read_x): fix reading from a port.
allow non-fports.
(scm_uniform_array_write): likewise.
1999-06-29 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_drain_input): rewritten.
* fports.c (local_fclose): check putback_buf.
(local_read_flush): likewise.
* ports.c (scm_remove_from_port_table): maybe free putback_buf.
* ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/
putback_buf_size.
(SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE.
* ports.c (scm_grow_port_cbuf): deleted.
(scm_add_to_port_table): initialise putback_buf to 0. remove cbuf
stuff.
(scm_char_ready_p): check putback_buf
(scm_fill_buffer): likewise.
(scm_ungetc): rewritten.
1999-06-27 Gary Houston <ghouston@easynet.co.uk>
* fports.c (local_fclose): account for push-back buffer.
* ports.c (scm_char_ready_p): check the push-back buffer in
a new way.
* ioext.c (scm_do_read_line): remove the extra code to handle
the push-back buffer.
* ports.c (scm_getc): don't use SCM_CRDYP etc.
* ioext.c (scm_do_read_line): call scm_fill_buffer.
* ports.c (scm_ungetc): don't call SCM_CUNGET. reset the
read buffer pointers.
scm_fill_buffer: new procedure.
(scm_getc): call scm_fill_buffer.
* ports.h (struct scm_port): saved_read_buf, saved_read_pos,
saved_read_end: new fields.
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* configure.in: don't check for ways to violate stdio abstraction.
1999-07-04 11:02:21 +00:00
|
|
|
|
|
|
|
|
|
|
if (pt->rw_random)
|
|
|
|
|
|
pt->rw_active = SCM_PORT_READ;
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
else /* file descriptor. */
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_SYSCALL (ans = read (SCM_INUM (port_or_fd),
|
2000-09-26 21:53:49 +00:00
|
|
|
|
base + (cstart + offset) * sz,
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
(scm_sizet) (sz * (cend - offset))));
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
if (ans == -1)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (SCM_TYP7 (v) == scm_tc7_bvect)
|
|
|
|
|
|
ans *= SCM_LONG_BIT;
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
|
2000-04-18 14:12:07 +00:00
|
|
|
|
if (!SCM_EQ_P (v, ra) && !SCM_EQ_P (cra, ra))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_array_copy_x (cra, ra);
|
Give GCC more control flow information, so it can be sure that
variables aren't used uninitialized.
* error.h (scm_error, scm_syserror, scm_syserror_msg,
scm_sysmissing, scm_num_overflow, scm_out_of_range,
scm_wrong_num_args, scm_wrong_type_arg, scm_memory_error,
scm_misc_error): Tell GCC that these functions never return.
* struct.c (scm_struct_ref, scm_struct_set_x): If we can't figure
out the field type, call abort if SCM_ASSERT returns, to placate
the optimizer.
* stacks.c (scm_make_stack, scm_last_stack_frame): abort if
scm_wta ever returns. We can't handle this case anyway, and this
gives the optimizer more information.
* unif.c (scm_uniform_vector_ref, scm_array_set_x): Abort if
scm_wta ever returns.
In some cases, the code is fine, but GCC isn't smart enough to
figure that out; this usually happens when one variable is only
initialized and used when a particular condition holds true, and
we know that condition will never change within a given invocation
of the function. In this case, we simply initialize the variables
to placate the compiler, hopefully to a value which will cause a
crash if it is ever actually used.
* print.c (scm_iprin1): Initialize mw_pos.
* read.c (scm_lreadrecparen): Initialize tl2, ans2.
* throw.c (scm_ithrow): Initialize dynpair.
* unif.c (scm_uniform_vector_ref): Initialize cra.
* struct.c (init_struct): Initialize prot.
* mbstrings.c (scm_print_mb_symbol): Initialize mw_pos and inc.
1996-12-18 21:41:44 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_MAKINUM (ans);
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_uniform_array_write, "uniform-array-write", 1, 3, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM v, SCM port_or_fd, SCM start, SCM end),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"@deffnx primitive uniform-vector-write uve [port-or-fdes] [start] [end]\n"
|
|
|
|
|
|
"Writes all elements of @var{ura} as binary objects to\n"
|
|
|
|
|
|
"@var{port-or-fdes}.\n\n"
|
|
|
|
|
|
"The optional arguments @var{start}\n"
|
|
|
|
|
|
"and @var{end} allow\n"
|
|
|
|
|
|
"a specified region of a vector (or linearized array) to be written.\n\n"
|
|
|
|
|
|
"The number of objects actually written is returned. \n"
|
|
|
|
|
|
"@var{port-or-fdes} may be\n"
|
|
|
|
|
|
"omitted, in which case it defaults to the value returned by\n"
|
|
|
|
|
|
"@code{(current-output-port)}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_uniform_array_write
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
long sz, vlen, ans;
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
long offset = 0;
|
|
|
|
|
|
long cstart = 0;
|
|
|
|
|
|
long cend;
|
2000-09-26 21:53:49 +00:00
|
|
|
|
char *base;
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
|
* filesys.c (scm_close, set_element, get_element, scm_chown,
scm_chmod, scm_stat, scm_truncate_file, scm_fcntl, scm_fsync): Use
SCM_COERCE_OUTPORT to cope with the printstate/port magic.
* ports.c (scm_port_revealed, scm_set_port_revealed_x,
scm_close_port, scm_port_line, scm_set_port_line_x,
scm_port_column, scm_set_port_column_x, scm_port_filename,
scm_set_port_filename_x, scm_port_mode,
scm_close_all_ports_except, scm_set_current_output_port,
scm_set_current_error_port): Likewise
* ioext.c (scm_redirect_port, scm_dup_to_fdes, scm_freopen,
scm_ftell, scm_fileno, scm_isatty_p, scm_primitive_move_to_fdes):
Likewise
* posix.c (scm_ttyname, scm_tcgetpgrp, scm_tcsetpgrp): Likewise
* backtrace.c (display_backtrace_body): Likewise
* fports (scm_setvbuf): Likewise
* socket.c (scm_getsockopt, scm_setsockopt, scm_shutdown,
scm_connect, scm_bind, scm_listen, scm_accept, scm_getsockname,
scm_getpeername, scm_send, scm_sendto): Likewise
* unif.c (scm_uniform_array_write): Likewise
1997-10-25 21:54:12 +00:00
|
|
|
|
port_or_fd = SCM_COERCE_OUTPORT (port_or_fd);
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ASRTGO (SCM_NIMP (v), badarg1);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
if (SCM_UNBNDP (port_or_fd))
|
|
|
|
|
|
port_or_fd = scm_cur_outp;
|
|
|
|
|
|
else
|
|
|
|
|
|
SCM_ASSERT (SCM_INUMP (port_or_fd)
|
1999-12-16 20:48:05 +00:00
|
|
|
|
|| (SCM_OPOUTPORTP (port_or_fd)),
|
1999-12-12 02:36:16 +00:00
|
|
|
|
port_or_fd, SCM_ARG2, FUNC_NAME);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
vlen = SCM_INUM (scm_uniform_vector_length (v));
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
loop:
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
switch SCM_TYP7 (v)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg1:SCM_WRONG_TYPE_ARG (1, v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
SCM_ASRTGO (SCM_ARRAYP (v), badarg1);
|
|
|
|
|
|
v = scm_ra2contig (v, 1);
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
cstart = SCM_ARRAY_BASE (v);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
vlen = SCM_ARRAY_DIMS (v)->inc
|
|
|
|
|
|
* (SCM_ARRAY_DIMS (v)->ubnd - SCM_ARRAY_DIMS (v)->lbnd + 1);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
v = SCM_ARRAY_V (v);
|
|
|
|
|
|
goto loop;
|
|
|
|
|
|
case scm_tc7_string:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = SCM_STRING_CHARS (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (char);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_bvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_BITVECTOR_BASE (v);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
vlen = (vlen + SCM_LONG_BIT - 1) / SCM_LONG_BIT;
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
cstart /= SCM_LONG_BIT;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
sz = sizeof (long);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
|
|
|
|
|
sz = sizeof (char);
|
|
|
|
|
|
break;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
case scm_tc7_ivect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (long);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_svect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (short);
|
|
|
|
|
|
break;
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (long_long);
|
|
|
|
|
|
break;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
case scm_tc7_fvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (float);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_dvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = sizeof (double);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_cvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
base = (char *) SCM_UVECTOR_BASE (v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
sz = 2 * sizeof (double);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
cend = vlen;
|
|
|
|
|
|
if (!SCM_UNBNDP (start))
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
{
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
offset =
|
1999-12-18 23:24:35 +00:00
|
|
|
|
SCM_NUM2LONG (3, start);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
if (offset < 0 || offset >= cend)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_out_of_range (FUNC_NAME, start);
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
|
|
|
|
|
|
if (!SCM_UNBNDP (end))
|
|
|
|
|
|
{
|
|
|
|
|
|
long tend =
|
1999-12-18 23:24:35 +00:00
|
|
|
|
SCM_NUM2LONG (4, end);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
if (tend <= offset || tend > cend)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_out_of_range (FUNC_NAME, end);
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
cend = tend;
|
|
|
|
|
|
}
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (SCM_NIMP (port_or_fd))
|
|
|
|
|
|
{
|
2000-09-26 21:53:49 +00:00
|
|
|
|
char *source = base + (cstart + offset) * sz;
|
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* strports.c (scm_strprint_obj): bug fix: get pt from the port,
not from the parameter obj. (Thanks to Eric Moore.)
* ports.h: SCM_CRDY, SCM_CUC, SCM_CRDYP, SCM_SETRDY, SCM_CUNGET,
SCM_CGETUN, SCM_CLRDY, SCM_TRY_CLRDY, SCM_N_READY_CHARS: deleted.
* strings.c (scm_make_string): throw error if 2nd arg isn't
a char.
* unif.c (scm_uniform_array_read_x): fix reading from a port.
allow non-fports.
(scm_uniform_array_write): likewise.
1999-06-29 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_drain_input): rewritten.
* fports.c (local_fclose): check putback_buf.
(local_read_flush): likewise.
* ports.c (scm_remove_from_port_table): maybe free putback_buf.
* ports.h (scm_port): replace cbuf/cbufend/cp with putback_buf/
putback_buf_size.
(SCM_INITIAL_PUTBACK_BUF_SIZE): renamed from SCM_INITIAL_CBUF_SIZE.
* ports.c (scm_grow_port_cbuf): deleted.
(scm_add_to_port_table): initialise putback_buf to 0. remove cbuf
stuff.
(scm_char_ready_p): check putback_buf
(scm_fill_buffer): likewise.
(scm_ungetc): rewritten.
1999-06-27 Gary Houston <ghouston@easynet.co.uk>
* fports.c (local_fclose): account for push-back buffer.
* ports.c (scm_char_ready_p): check the push-back buffer in
a new way.
* ioext.c (scm_do_read_line): remove the extra code to handle
the push-back buffer.
* ports.c (scm_getc): don't use SCM_CRDYP etc.
* ioext.c (scm_do_read_line): call scm_fill_buffer.
* ports.c (scm_ungetc): don't call SCM_CUNGET. reset the
read buffer pointers.
scm_fill_buffer: new procedure.
(scm_getc): call scm_fill_buffer.
* ports.h (struct scm_port): saved_read_buf, saved_read_pos,
saved_read_end: new fields.
1999-07-04 Gary Houston <ghouston@easynet.co.uk>
* configure.in: don't check for ways to violate stdio abstraction.
1999-07-04 11:02:21 +00:00
|
|
|
|
|
|
|
|
|
|
ans = cend - offset;
|
1999-08-04 18:15:31 +00:00
|
|
|
|
scm_lfwrite (source, ans * sz, port_or_fd);
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
else /* file descriptor. */
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_SYSCALL (ans = write (SCM_INUM (port_or_fd),
|
2000-09-26 21:53:49 +00:00
|
|
|
|
base + (cstart + offset) * sz,
|
* ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
Add a rule for generating errnos.list.
(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.
* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
don't extract errnos, just set a variable (avoids the
need to recompile error.c just because configure is run.)
* unif.h: update prototypes.
* unif.c (scm_uniform_array_read,write): change the offset and
length arguments to start and end, for consistency.
* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.
* ioext.h: update prototypes.
* * ioext.c (scm_read_delimited_x): replaces scm_read_line and
scm_read_line_x, it's a more general procedure using an
interface from scsh. read-line and read-line! are now defined
in boot-9.scm.
* Note that the new read-line trims the terminator
by default, previously it was appended to the returned string. An
optional argument specifies how to process the terminator (scsh
compatible). For the old behaviour: (read-line port 'concat).
scm_read_line, scm_read_line_x: deleted. (read-line port 'split)
returns a pair, but is converted to multiple values if the scsh
module is loaded.
socket.h: update prototypes.
* socket.c (scm_recvfrom): for consistency with other procedures,
take start and end as separate optional arguments.
* (scm_recv, scm_recvfrom): don't allow the second argument
to be a size, only a buffer. Change the scheme names to
recv! and recvfrom!. Don't return the buffer.
* ioext.h, posix.h: move prototypes too.
* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
moved back from posix.c to ioext.c. Also move #includes of "genio.h"
"read.h" and "unif.h".
* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
|
|
|
|
(scm_sizet) (sz * (cend - offset))));
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
if (ans == -1)
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_SYSERROR;
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (SCM_TYP7 (v) == scm_tc7_bvect)
|
|
|
|
|
|
ans *= SCM_LONG_BIT;
|
* init.scm (index, rindex): replace versions in utilities.scm with
primitives.
load errno.scm.
* netconst.scm: undefine maybe-define and maybe-define-so after use.
* errno.scm: new file.
* fports.c (scm_open_file): pass errno to scm_syserror_msg.
* filesys.h: update prototypes. Remove macros: SCM_FD_P, SCM_FD_FLAGS,
SCM_FD.
* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
scm_syserror_msg.
* (scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
scm_sys_dup): deleted: FD capability will be added to other
procedures.
* Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
scm_fd_free, fd_smob, scm_intern_fd.
* (scm_open): renamed from scm_sys_open. Return a port instead of
an FD object. Make the mode argument optional.
* (scm_sys_create): deleted, it's just a special case of open.
(scm_init_filesys): move interning of constants O_CREAT etc.,
here (were previously using SCM_CONST_LONG macro).
Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
don't newsmob fd.
(numerous _sys_ procedures): remove gratuitous _sys_ from names.
include "fports.h" and <stdio.h>
(scm_stat, scm_select): don't support FD objects.
* error.h: adjust scm_syserror_msg prototype.
* error.c (scm_syserror_msg): take an extra argument for errno.
Using the global value didn't always work, since it could be
reset by procedure calls in the message or args arguments.
* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
I don't understand why the check was there (and what about the
ultrix check?)
* strop.c (scm_string_copy): allow shared substrings to be copied.
* unif.h: corresponding change to prototypes.
* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
recognize two new optional arguments: offset and length. Allow
the port argument to be an integer (file descriptor, for scsh).
Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_MAKINUM (ans);
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char cnt_tab[16] =
|
|
|
|
|
|
{0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_bit_count, "bit-count", 2, 0, 0,
|
2001-02-17 11:25:34 +00:00
|
|
|
|
(SCM b, SCM bitvector),
|
|
|
|
|
|
"Returns the number of occurrences of the boolean @var{b} in\n"
|
|
|
|
|
|
"@var{bitvector}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_bit_count
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-05-20 10:07:44 +00:00
|
|
|
|
SCM_VALIDATE_BOOL (1, b);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
SCM_ASSERT (SCM_BITVECTOR_P (bitvector), bitvector, 2, FUNC_NAME);
|
|
|
|
|
|
if (SCM_BITVECTOR_LENGTH (bitvector) == 0) {
|
2000-05-20 10:07:44 +00:00
|
|
|
|
return SCM_INUM0;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
unsigned long int count = 0;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
unsigned long int i = (SCM_BITVECTOR_LENGTH (bitvector) - 1) / SCM_LONG_BIT;
|
2000-05-20 10:07:44 +00:00
|
|
|
|
unsigned long int w = SCM_UNPACK (SCM_VELTS (bitvector)[i]);
|
|
|
|
|
|
if (SCM_FALSEP (b)) {
|
|
|
|
|
|
w = ~w;
|
|
|
|
|
|
};
|
2000-10-11 12:24:43 +00:00
|
|
|
|
w <<= SCM_LONG_BIT - 1 - ((SCM_BITVECTOR_LENGTH (bitvector) - 1) % SCM_LONG_BIT);
|
2000-05-20 10:07:44 +00:00
|
|
|
|
while (1) {
|
|
|
|
|
|
while (w) {
|
|
|
|
|
|
count += cnt_tab[w & 0x0f];
|
|
|
|
|
|
w >>= 4;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
|
return SCM_MAKINUM (count);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
--i;
|
|
|
|
|
|
w = SCM_UNPACK (SCM_VELTS (bitvector)[i]);
|
|
|
|
|
|
if (SCM_FALSEP (b)) {
|
|
|
|
|
|
w = ~w;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
2000-05-20 10:07:44 +00:00
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
2000-05-20 10:07:44 +00:00
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_bit_position, "bit-position", 3, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM item, SCM v, SCM k),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns the minimum index of an occurrence of @var{bool} in @var{bv}\n"
|
|
|
|
|
|
"which is at least @var{k}. If no @var{bool} occurs within the specified\n"
|
|
|
|
|
|
"range @code{#f} is returned.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_bit_position
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
1999-12-12 02:36:16 +00:00
|
|
|
|
long i, lenw, xbits, pos;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
register unsigned long w;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
|
|
|
|
|
|
SCM_VALIDATE_BOOL (1, item);
|
|
|
|
|
|
SCM_ASSERT (SCM_BITVECTOR_P (v), v, SCM_ARG2, FUNC_NAME);
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_VALIDATE_INUM_COPY (3,k,pos);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
SCM_ASSERT_RANGE (3, k, (pos <= SCM_BITVECTOR_LENGTH (v)) && (pos >= 0));
|
|
|
|
|
|
|
|
|
|
|
|
if (pos == SCM_BITVECTOR_LENGTH (v))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_BOOL_F;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
|
|
|
|
|
|
lenw = (SCM_BITVECTOR_LENGTH (v) - 1) / SCM_LONG_BIT; /* watch for part words */
|
|
|
|
|
|
i = pos / SCM_LONG_BIT;
|
|
|
|
|
|
w = SCM_UNPACK (SCM_VELTS (v)[i]);
|
|
|
|
|
|
if (SCM_FALSEP (item))
|
|
|
|
|
|
w = ~w;
|
|
|
|
|
|
xbits = (pos % SCM_LONG_BIT);
|
|
|
|
|
|
pos -= xbits;
|
|
|
|
|
|
w = ((w >> xbits) << xbits);
|
|
|
|
|
|
xbits = SCM_LONG_BIT - 1 - (SCM_BITVECTOR_LENGTH (v) - 1) % SCM_LONG_BIT;
|
|
|
|
|
|
while (!0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (w && (i == lenw))
|
|
|
|
|
|
w = ((w << xbits) >> xbits);
|
|
|
|
|
|
if (w)
|
|
|
|
|
|
while (w)
|
|
|
|
|
|
switch (w & 0x0f)
|
|
|
|
|
|
{
|
|
|
|
|
|
default:
|
|
|
|
|
|
return SCM_MAKINUM (pos);
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
case 6:
|
|
|
|
|
|
case 10:
|
|
|
|
|
|
case 14:
|
|
|
|
|
|
return SCM_MAKINUM (pos + 1);
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
case 12:
|
|
|
|
|
|
return SCM_MAKINUM (pos + 2);
|
|
|
|
|
|
case 8:
|
|
|
|
|
|
return SCM_MAKINUM (pos + 3);
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
pos += 4;
|
|
|
|
|
|
w >>= 4;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (++i > lenw)
|
|
|
|
|
|
break;
|
|
|
|
|
|
pos += SCM_LONG_BIT;
|
2000-03-12 18:30:33 +00:00
|
|
|
|
w = SCM_UNPACK (SCM_VELTS (v)[i]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (SCM_FALSEP (item))
|
|
|
|
|
|
w = ~w;
|
|
|
|
|
|
}
|
2000-10-11 12:24:43 +00:00
|
|
|
|
return SCM_BOOL_F;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0,
|
2001-02-17 11:25:34 +00:00
|
|
|
|
(SCM v, SCM kv, SCM obj),
|
|
|
|
|
|
"If uve is a bit-vector @var{bv} and uve must be of the same\n"
|
|
|
|
|
|
"length. If @var{bool} is @code{#t}, uve is OR'ed into\n"
|
|
|
|
|
|
"@var{bv}; If @var{bool} is @code{#f}, the inversion of uve is\n"
|
|
|
|
|
|
"AND'ed into @var{bv}.\n\n"
|
|
|
|
|
|
"If uve is a unsigned integer vector all the elements of uve\n"
|
|
|
|
|
|
"must be between 0 and the @code{length} of @var{bv}. The bits\n"
|
|
|
|
|
|
"of @var{bv} corresponding to the indexes in uve are set to\n"
|
|
|
|
|
|
"@var{bool}. The return value is unspecified.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_bit_set_star_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
register long i, k, vlen;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
SCM_ASSERT (SCM_BITVECTOR_P (v), v, SCM_ARG1, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ASRTGO (SCM_NIMP (kv), badarg2);
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
switch SCM_TYP7 (kv)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg2:SCM_WRONG_TYPE_ARG (2, kv);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_uvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
vlen = SCM_BITVECTOR_LENGTH (v);
|
|
|
|
|
|
if (SCM_FALSEP (obj))
|
|
|
|
|
|
for (i = SCM_UVECTOR_LENGTH (kv); i;)
|
|
|
|
|
|
{
|
|
|
|
|
|
k = SCM_UNPACK (SCM_VELTS (kv)[--i]);
|
|
|
|
|
|
if (k >= vlen)
|
|
|
|
|
|
scm_out_of_range (FUNC_NAME, SCM_MAKINUM (k));
|
|
|
|
|
|
SCM_BITVEC_CLR(v,k);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (SCM_EQ_P (obj, SCM_BOOL_T))
|
|
|
|
|
|
for (i = SCM_UVECTOR_LENGTH (kv); i;)
|
|
|
|
|
|
{
|
|
|
|
|
|
k = SCM_UNPACK (SCM_VELTS (kv)[--i]);
|
|
|
|
|
|
if (k >= vlen)
|
|
|
|
|
|
scm_out_of_range (FUNC_NAME, SCM_MAKINUM (k));
|
|
|
|
|
|
SCM_BITVEC_SET(v,k);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg3:SCM_WRONG_TYPE_ARG (3, obj);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_bvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
SCM_ASSERT (SCM_BITVECTOR_LENGTH (v) == SCM_BITVECTOR_LENGTH (kv), v, SCM_ARG1, FUNC_NAME);
|
2000-04-04 12:13:41 +00:00
|
|
|
|
if (SCM_FALSEP (obj))
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = (SCM_BITVECTOR_LENGTH (v) + SCM_LONG_BIT - 1) / SCM_LONG_BIT; k--;)
|
2000-03-12 18:30:33 +00:00
|
|
|
|
SCM_UNPACK (SCM_VELTS (v)[k]) &= ~ SCM_UNPACK(SCM_VELTS (kv)[k]);
|
2000-06-05 11:39:46 +00:00
|
|
|
|
else if (SCM_EQ_P (obj, SCM_BOOL_T))
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = (SCM_BITVECTOR_LENGTH (v) + SCM_LONG_BIT - 1) / SCM_LONG_BIT; k--;)
|
2000-03-12 18:30:33 +00:00
|
|
|
|
SCM_UNPACK (SCM_VELTS (v)[k]) |= SCM_UNPACK (SCM_VELTS (kv)[k]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
else
|
|
|
|
|
|
goto badarg3;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM v, SCM kv, SCM obj),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns\n"
|
|
|
|
|
|
"@example\n"
|
|
|
|
|
|
"(bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t).\n"
|
|
|
|
|
|
"@end example\n"
|
|
|
|
|
|
"@var{bv} is not modified.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_bit_count_star
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
register long i, vlen, count = 0;
|
|
|
|
|
|
register unsigned long k;
|
2000-03-09 21:48:25 +00:00
|
|
|
|
int fObj = 0;
|
2000-03-09 18:58:58 +00:00
|
|
|
|
|
2000-10-11 12:24:43 +00:00
|
|
|
|
SCM_ASSERT (SCM_BITVECTOR_P (v), v, SCM_ARG1, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ASRTGO (SCM_NIMP (kv), badarg2);
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
switch SCM_TYP7 (kv)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2000-03-09 18:58:58 +00:00
|
|
|
|
badarg2:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
SCM_WRONG_TYPE_ARG (2, kv);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_uvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
vlen = SCM_BITVECTOR_LENGTH (v);
|
|
|
|
|
|
if (SCM_FALSEP (obj))
|
|
|
|
|
|
for (i = SCM_UVECTOR_LENGTH (kv); i;)
|
|
|
|
|
|
{
|
|
|
|
|
|
k = SCM_UNPACK (SCM_VELTS (kv)[--i]);
|
|
|
|
|
|
if (k >= vlen)
|
|
|
|
|
|
scm_out_of_range (FUNC_NAME, SCM_MAKINUM (k));
|
|
|
|
|
|
if (!SCM_BITVEC_REF(v,k))
|
|
|
|
|
|
count++;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (SCM_EQ_P (obj, SCM_BOOL_T))
|
|
|
|
|
|
for (i = SCM_UVECTOR_LENGTH (kv); i;)
|
|
|
|
|
|
{
|
|
|
|
|
|
k = SCM_UNPACK (SCM_VELTS (kv)[--i]);
|
|
|
|
|
|
if (k >= vlen)
|
|
|
|
|
|
scm_out_of_range (FUNC_NAME, SCM_MAKINUM (k));
|
|
|
|
|
|
if (SCM_BITVEC_REF (v,k))
|
|
|
|
|
|
count++;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg3:SCM_WRONG_TYPE_ARG (3, obj);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_bvect:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
SCM_ASSERT (SCM_BITVECTOR_LENGTH (v) == SCM_BITVECTOR_LENGTH (kv), v, SCM_ARG1, FUNC_NAME);
|
|
|
|
|
|
if (0 == SCM_BITVECTOR_LENGTH (v))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_INUM0;
|
2000-04-04 12:13:41 +00:00
|
|
|
|
SCM_ASRTGO (SCM_BOOLP (obj), badarg3);
|
2000-06-05 11:39:46 +00:00
|
|
|
|
fObj = SCM_EQ_P (obj, SCM_BOOL_T);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
i = (SCM_BITVECTOR_LENGTH (v) - 1) / SCM_LONG_BIT;
|
2000-03-12 18:30:33 +00:00
|
|
|
|
k = SCM_UNPACK (SCM_VELTS (kv)[i]) & (fObj ? SCM_UNPACK (SCM_VELTS (v)[i]) : ~ SCM_UNPACK (SCM_VELTS (v)[i]));
|
2000-10-11 12:24:43 +00:00
|
|
|
|
k <<= SCM_LONG_BIT - 1 - ((SCM_BITVECTOR_LENGTH (v) - 1) % SCM_LONG_BIT);
|
2000-03-09 18:58:58 +00:00
|
|
|
|
while (1)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
for (; k; k >>= 4)
|
|
|
|
|
|
count += cnt_tab[k & 0x0f];
|
|
|
|
|
|
if (0 == i--)
|
|
|
|
|
|
return SCM_MAKINUM (count);
|
2000-03-09 18:58:58 +00:00
|
|
|
|
|
|
|
|
|
|
/* urg. repetitive (see above.) */
|
2000-03-12 18:30:33 +00:00
|
|
|
|
k = SCM_UNPACK (SCM_VELTS (kv)[i]) & (fObj ? SCM_UNPACK(SCM_VELTS (v)[i]) : ~SCM_UNPACK (SCM_VELTS (v)[i]));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return SCM_MAKINUM (count);
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_bit_invert_x, "bit-invert!", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM v),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Modifies @var{bv} by replacing each element with its negation.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_bit_invert_x
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-10-11 12:24:43 +00:00
|
|
|
|
long int k;
|
|
|
|
|
|
|
|
|
|
|
|
SCM_ASSERT (SCM_BITVECTOR_P (v), v, SCM_ARG1, FUNC_NAME);
|
|
|
|
|
|
|
|
|
|
|
|
k = SCM_BITVECTOR_LENGTH (v);
|
|
|
|
|
|
for (k = (k + SCM_LONG_BIT - 1) / SCM_LONG_BIT; k--;)
|
|
|
|
|
|
SCM_UNPACK (SCM_VELTS (v)[k]) = ~SCM_UNPACK (SCM_VELTS (v)[k]);
|
|
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SCM
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_istr2bve (char *str, long len)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM v = scm_make_uve (len, SCM_BOOL_T);
|
|
|
|
|
|
long *data = (long *) SCM_VELTS (v);
|
|
|
|
|
|
register unsigned long mask;
|
|
|
|
|
|
register long k;
|
|
|
|
|
|
register long j;
|
|
|
|
|
|
for (k = 0; k < (len + SCM_LONG_BIT - 1) / SCM_LONG_BIT; k++)
|
|
|
|
|
|
{
|
|
|
|
|
|
data[k] = 0L;
|
|
|
|
|
|
j = len - k * SCM_LONG_BIT;
|
|
|
|
|
|
if (j > SCM_LONG_BIT)
|
|
|
|
|
|
j = SCM_LONG_BIT;
|
|
|
|
|
|
for (mask = 1L; j--; mask <<= 1)
|
|
|
|
|
|
switch (*str++)
|
|
|
|
|
|
{
|
|
|
|
|
|
case '0':
|
|
|
|
|
|
break;
|
|
|
|
|
|
case '1':
|
|
|
|
|
|
data[k] |= mask;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
return SCM_BOOL_F;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
static SCM
|
1999-12-12 02:36:16 +00:00
|
|
|
|
ra2l (SCM ra,scm_sizet base,scm_sizet k)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
register SCM res = SCM_EOL;
|
|
|
|
|
|
register long inc = SCM_ARRAY_DIMS (ra)[k].inc;
|
|
|
|
|
|
register scm_sizet i;
|
|
|
|
|
|
if (SCM_ARRAY_DIMS (ra)[k].ubnd < SCM_ARRAY_DIMS (ra)[k].lbnd)
|
|
|
|
|
|
return SCM_EOL;
|
|
|
|
|
|
i = base + (1 + SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd) * inc;
|
|
|
|
|
|
if (k < SCM_ARRAY_NDIM (ra) - 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
i -= inc;
|
|
|
|
|
|
res = scm_cons (ra2l (ra, i, k + 1), res);
|
|
|
|
|
|
}
|
|
|
|
|
|
while (i != base);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
i -= inc;
|
|
|
|
|
|
res = scm_cons (scm_uniform_vector_ref (SCM_ARRAY_V (ra), SCM_MAKINUM (i)), res);
|
|
|
|
|
|
}
|
|
|
|
|
|
while (i != base);
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_array_to_list, "array->list", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM v),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns a list consisting of all the elements, in order, of @var{array}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_array_to_list
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM res = SCM_EOL;
|
|
|
|
|
|
register long k;
|
|
|
|
|
|
SCM_ASRTGO (SCM_NIMP (v), badarg1);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
switch SCM_TYP7 (v)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg1:SCM_WRONG_TYPE_ARG (1, v);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
SCM_ASRTGO (SCM_ARRAYP (v), badarg1);
|
|
|
|
|
|
return ra2l (v, SCM_ARRAY_BASE (v), 0);
|
|
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return scm_vector_to_list (v);
|
|
|
|
|
|
case scm_tc7_string:
|
|
|
|
|
|
return scm_string_to_list (v);
|
|
|
|
|
|
case scm_tc7_bvect:
|
|
|
|
|
|
{
|
|
|
|
|
|
long *data = (long *) SCM_VELTS (v);
|
|
|
|
|
|
register unsigned long mask;
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = (SCM_BITVECTOR_LENGTH (v) - 1) / SCM_LONG_BIT; k > 0; k--)
|
1997-06-21 05:53:39 +00:00
|
|
|
|
for (mask = 1UL << (SCM_LONG_BIT - 1); mask; mask >>= 1)
|
1999-12-12 19:24:29 +00:00
|
|
|
|
res = scm_cons (SCM_BOOL(((long *) data)[k] & mask), res);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (mask = 1L << ((SCM_BITVECTOR_LENGTH (v) % SCM_LONG_BIT) - 1); mask; mask >>= 1)
|
1999-12-12 19:24:29 +00:00
|
|
|
|
res = scm_cons (SCM_BOOL(((long *) data)[k] & mask), res);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
case scm_tc7_uvect: {
|
|
|
|
|
|
long *data = (long *)SCM_VELTS(v);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = SCM_UVECTOR_LENGTH(v) - 1; k >= 0; k--)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
res = scm_cons(scm_ulong2num(data[k]), res);
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
case scm_tc7_ivect: {
|
|
|
|
|
|
long *data = (long *)SCM_VELTS(v);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = SCM_UVECTOR_LENGTH(v) - 1; k >= 0; k--)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
res = scm_cons(scm_long2num(data[k]), res);
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
case scm_tc7_svect: {
|
|
|
|
|
|
short *data;
|
|
|
|
|
|
data = (short *)SCM_VELTS(v);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = SCM_UVECTOR_LENGTH(v) - 1; k >= 0; k--)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
res = scm_cons(SCM_MAKINUM (data[k]), res);
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect: {
|
|
|
|
|
|
long_long *data;
|
|
|
|
|
|
data = (long_long *)SCM_VELTS(v);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = SCM_UVECTOR_LENGTH(v) - 1; k >= 0; k--)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
res = scm_cons(scm_long_long2num(data[k]), res);
|
|
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case scm_tc7_fvect:
|
|
|
|
|
|
{
|
|
|
|
|
|
float *data = (float *) SCM_VELTS (v);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = SCM_UVECTOR_LENGTH (v) - 1; k >= 0; k--)
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
res = scm_cons (scm_make_real (data[k]), res);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
case scm_tc7_dvect:
|
|
|
|
|
|
{
|
|
|
|
|
|
double *data = (double *) SCM_VELTS (v);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = SCM_UVECTOR_LENGTH (v) - 1; k >= 0; k--)
|
2000-05-02 16:41:20 +00:00
|
|
|
|
res = scm_cons (scm_make_real (data[k]), res);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
case scm_tc7_cvect:
|
|
|
|
|
|
{
|
|
|
|
|
|
double (*data)[2] = (double (*)[2]) SCM_VELTS (v);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (k = SCM_UVECTOR_LENGTH (v) - 1; k >= 0; k--)
|
2000-05-02 16:41:20 +00:00
|
|
|
|
res = scm_cons (scm_make_complex (data[k][0], data[k][1]), res);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return res;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
static int l2ra(SCM lst, SCM ra, scm_sizet base, scm_sizet k);
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_list_to_uniform_array, "list->uniform-array", 3, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM ndim, SCM prot, SCM lst),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"@deffnx procedure list->uniform-vector prot lst\n"
|
|
|
|
|
|
"Returns a uniform array of the type indicated by prototype @var{prot}\n"
|
|
|
|
|
|
"with elements the same as those of @var{lst}. Elements must be of the\n"
|
|
|
|
|
|
"appropriate type, no coercions are done.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_list_to_uniform_array
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM shp = SCM_EOL;
|
|
|
|
|
|
SCM row = lst;
|
|
|
|
|
|
SCM ra;
|
|
|
|
|
|
scm_sizet k;
|
|
|
|
|
|
long n;
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_VALIDATE_INUM_COPY (1,ndim,k);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
while (k--)
|
|
|
|
|
|
{
|
|
|
|
|
|
n = scm_ilength (row);
|
1999-12-12 02:36:16 +00:00
|
|
|
|
SCM_ASSERT (n >= 0, lst, SCM_ARG3, FUNC_NAME);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
shp = scm_cons (SCM_MAKINUM (n), shp);
|
|
|
|
|
|
if (SCM_NIMP (row))
|
|
|
|
|
|
row = SCM_CAR (row);
|
|
|
|
|
|
}
|
1999-11-20 19:21:37 +00:00
|
|
|
|
ra = scm_dimensions_to_uniform_array (scm_reverse (shp), prot,
|
|
|
|
|
|
SCM_UNDEFINED);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (SCM_NULLP (shp))
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ASRTGO (1 == scm_ilength (lst), badlst);
|
|
|
|
|
|
scm_array_set_x (ra, SCM_CAR (lst), SCM_EOL);
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!SCM_ARRAYP (ra))
|
|
|
|
|
|
{
|
2000-10-11 12:24:43 +00:00
|
|
|
|
unsigned long int length = SCM_INUM (scm_uniform_vector_length (ra));
|
|
|
|
|
|
for (k = 0; k < length; k++, lst = SCM_CDR (lst))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_array_set_x (ra, SCM_CAR (lst), SCM_MAKINUM (k));
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (l2ra (lst, ra, SCM_ARRAY_BASE (ra), 0))
|
|
|
|
|
|
return ra;
|
|
|
|
|
|
else
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badlst:SCM_MISC_ERROR ("Bad scm_array contents list: ~S", SCM_LIST1 (lst));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
|
|
|
|
|
static int
|
1999-12-12 02:36:16 +00:00
|
|
|
|
l2ra (SCM lst, SCM ra, scm_sizet base, scm_sizet k)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
register long inc = SCM_ARRAY_DIMS (ra)[k].inc;
|
|
|
|
|
|
register long n = (1 + SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd);
|
|
|
|
|
|
int ok = 1;
|
|
|
|
|
|
if (n <= 0)
|
2000-04-04 12:13:41 +00:00
|
|
|
|
return (SCM_NULLP (lst));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (k < SCM_ARRAY_NDIM (ra) - 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
while (n--)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (SCM_IMP (lst) || SCM_NCONSP (lst))
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
ok = ok && l2ra (SCM_CAR (lst), ra, base, k + 1);
|
|
|
|
|
|
base += inc;
|
|
|
|
|
|
lst = SCM_CDR (lst);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (SCM_NNULLP (lst))
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
while (n--)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (SCM_IMP (lst) || SCM_NCONSP (lst))
|
|
|
|
|
|
return 0;
|
2000-04-18 15:49:34 +00:00
|
|
|
|
scm_array_set_x (SCM_ARRAY_V (ra), SCM_CAR (lst), SCM_MAKINUM (base));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
base += inc;
|
|
|
|
|
|
lst = SCM_CDR (lst);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (SCM_NNULLP (lst))
|
2000-04-18 14:12:07 +00:00
|
|
|
|
return 0;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
return ok;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
static void
|
1999-12-12 02:36:16 +00:00
|
|
|
|
rapr1 (SCM ra,scm_sizet j,scm_sizet k,SCM port,scm_print_state *pstate)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
long inc = 1;
|
2001-01-31 15:18:47 +00:00
|
|
|
|
long n = (SCM_TYP7 (ra) == scm_tc7_smob
|
|
|
|
|
|
? 0
|
|
|
|
|
|
: SCM_INUM (scm_uniform_vector_length (ra)));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
int enclosed = 0;
|
|
|
|
|
|
tail:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
switch SCM_TYP7 (ra)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
if (enclosed++)
|
|
|
|
|
|
{
|
|
|
|
|
|
SCM_ARRAY_BASE (ra) = j;
|
|
|
|
|
|
if (n-- > 0)
|
* arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
|
|
|
|
scm_iprin1 (ra, port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
SCM_ARRAY_BASE (ra) = j;
|
* arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
|
|
|
|
scm_iprin1 (ra, port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (k + 1 < SCM_ARRAY_NDIM (ra))
|
|
|
|
|
|
{
|
|
|
|
|
|
long i;
|
|
|
|
|
|
inc = SCM_ARRAY_DIMS (ra)[k].inc;
|
|
|
|
|
|
for (i = SCM_ARRAY_DIMS (ra)[k].lbnd; i < SCM_ARRAY_DIMS (ra)[k].ubnd; i++)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('(', port);
|
* arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
|
|
|
|
rapr1 (ra, j, k + 1, port, pstate);
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts (") ", port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
j += inc;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (i == SCM_ARRAY_DIMS (ra)[k].ubnd)
|
|
|
|
|
|
{ /* could be zero size. */
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('(', port);
|
* arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
|
|
|
|
rapr1 (ra, j, k + 1, port, pstate);
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (')', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
if SCM_ARRAY_NDIM
|
|
|
|
|
|
(ra)
|
|
|
|
|
|
{ /* Could be zero-dimensional */
|
|
|
|
|
|
inc = SCM_ARRAY_DIMS (ra)[k].inc;
|
|
|
|
|
|
n = (SCM_ARRAY_DIMS (ra)[k].ubnd - SCM_ARRAY_DIMS (ra)[k].lbnd + 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
n = 1;
|
|
|
|
|
|
ra = SCM_ARRAY_V (ra);
|
|
|
|
|
|
goto tail;
|
|
|
|
|
|
default:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
/* scm_tc7_bvect and scm_tc7_llvect only? */
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (n-- > 0)
|
* arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
|
|
|
|
scm_iprin1 (scm_uniform_vector_ref (ra, SCM_MAKINUM (j)), port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
* arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
|
|
|
|
scm_iprin1 (scm_cvref (ra, j, SCM_UNDEFINED), port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_string:
|
|
|
|
|
|
if (n-- > 0)
|
2000-09-26 22:15:13 +00:00
|
|
|
|
scm_iprin1 (SCM_MAKE_CHAR (SCM_STRING_UCHARS (ra)[j]), port, pstate);
|
* arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
|
|
|
|
if (SCM_WRITINGP (pstate))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
2000-09-26 22:15:13 +00:00
|
|
|
|
scm_iprin1 (SCM_MAKE_CHAR (SCM_STRING_UCHARS (ra)[j]), port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
2000-09-26 21:53:49 +00:00
|
|
|
|
scm_putc (SCM_STRING_CHARS (ra)[j], port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_byvect:
|
|
|
|
|
|
if (n-- > 0)
|
2000-04-04 12:13:41 +00:00
|
|
|
|
scm_intprint (((char *) SCM_CELL_WORD_1 (ra))[j], 10, port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
2000-04-04 12:13:41 +00:00
|
|
|
|
scm_intprint (((char *)SCM_CELL_WORD_1 (ra))[j], 10, port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case scm_tc7_uvect:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
{
|
|
|
|
|
|
char str[11];
|
|
|
|
|
|
|
|
|
|
|
|
if (n-- > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
/* intprint can't handle >= 2^31. */
|
2000-04-18 14:12:07 +00:00
|
|
|
|
sprintf (str, "%lu", ((unsigned long *) SCM_VELTS (ra))[j]);
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
scm_puts (str, port);
|
|
|
|
|
|
}
|
|
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_putc (' ', port);
|
2000-04-18 14:12:07 +00:00
|
|
|
|
sprintf (str, "%lu", ((unsigned long *) SCM_VELTS (ra))[j]);
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
scm_puts (str, port);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
if (n-- > 0)
|
2000-04-18 14:12:07 +00:00
|
|
|
|
scm_intprint (((signed long *) SCM_VELTS (ra))[j], 10, port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
2000-04-18 14:12:07 +00:00
|
|
|
|
scm_intprint (((signed long *) SCM_VELTS (ra))[j], 10, port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case scm_tc7_svect:
|
|
|
|
|
|
if (n-- > 0)
|
2000-04-04 12:13:41 +00:00
|
|
|
|
scm_intprint (((short *) SCM_CELL_WORD_1 (ra))[j], 10, port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
2000-04-04 12:13:41 +00:00
|
|
|
|
scm_intprint (((short *) SCM_CELL_WORD_1 (ra))[j], 10, port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case scm_tc7_fvect:
|
|
|
|
|
|
if (n-- > 0)
|
|
|
|
|
|
{
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
SCM z = scm_make_real (1.0);
|
|
|
|
|
|
SCM_REAL_VALUE (z) = ((float *) SCM_VELTS (ra))[j];
|
|
|
|
|
|
scm_print_real (z, port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
SCM_REAL_VALUE (z) = ((float *) SCM_VELTS (ra))[j];
|
|
|
|
|
|
scm_print_real (z, port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_dvect:
|
|
|
|
|
|
if (n-- > 0)
|
|
|
|
|
|
{
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
SCM z = scm_make_real (1.0 / 3.0);
|
|
|
|
|
|
SCM_REAL_VALUE (z) = ((double *) SCM_VELTS (ra))[j];
|
|
|
|
|
|
scm_print_real (z, port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
SCM_REAL_VALUE (z) = ((double *) SCM_VELTS (ra))[j];
|
|
|
|
|
|
scm_print_real (z, port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_cvect:
|
|
|
|
|
|
if (n-- > 0)
|
|
|
|
|
|
{
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
SCM cz = scm_make_complex (0.0, 1.0), z = scm_make_real (1.0 / 3.0);
|
|
|
|
|
|
SCM_REAL_VALUE (z) =
|
|
|
|
|
|
SCM_COMPLEX_REAL (cz) = ((double *) SCM_VELTS (ra))[2 * j];
|
|
|
|
|
|
SCM_COMPLEX_IMAG (cz) = ((double *) SCM_VELTS (ra))[2 * j + 1];
|
|
|
|
|
|
scm_print_complex ((0.0 == SCM_COMPLEX_IMAG (cz) ? z : cz),
|
|
|
|
|
|
port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j += inc; n-- > 0; j += inc)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (' ', port);
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
SCM_REAL_VALUE (z)
|
|
|
|
|
|
= SCM_COMPLEX_REAL (cz) = ((double *) SCM_VELTS (ra))[2 * j];
|
|
|
|
|
|
SCM_COMPLEX_IMAG (cz) = ((double *) SCM_VELTS (ra))[2 * j + 1];
|
|
|
|
|
|
scm_print_complex ((0.0 == SCM_COMPLEX_IMAG (cz) ? z : cz),
|
|
|
|
|
|
port, pstate);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
int
|
1999-12-12 02:36:16 +00:00
|
|
|
|
scm_raprin1 (SCM exp, SCM port, scm_print_state *pstate)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
SCM v = exp;
|
|
|
|
|
|
scm_sizet base = 0;
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('#', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
tail:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
switch SCM_TYP7 (v)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
{
|
|
|
|
|
|
long ndim = SCM_ARRAY_NDIM (v);
|
|
|
|
|
|
base = SCM_ARRAY_BASE (v);
|
|
|
|
|
|
v = SCM_ARRAY_V (v);
|
|
|
|
|
|
if (SCM_ARRAYP (v))
|
|
|
|
|
|
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_puts ("<enclosed-array ", port);
|
* arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
|
|
|
|
rapr1 (exp, base, 0, port, pstate);
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('>', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
scm_intprint (ndim, 10, port);
|
|
|
|
|
|
goto tail;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
case scm_tc7_bvect:
|
2000-04-18 14:12:07 +00:00
|
|
|
|
if (SCM_EQ_P (exp, v))
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{ /* a uve, not an scm_array */
|
|
|
|
|
|
register long i, j, w;
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('*', port);
|
2000-10-11 12:24:43 +00:00
|
|
|
|
for (i = 0; i < (SCM_BITVECTOR_LENGTH (exp)) / SCM_LONG_BIT; i++)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-03-12 18:30:33 +00:00
|
|
|
|
scm_bits_t w = SCM_UNPACK (SCM_VELTS (exp)[i]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (j = SCM_LONG_BIT; j; j--)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (w & 1 ? '1' : '0', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
w >>= 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2000-10-11 12:24:43 +00:00
|
|
|
|
j = SCM_BITVECTOR_LENGTH (exp) % SCM_LONG_BIT;
|
1996-07-25 22:56:11 +00:00
|
|
|
|
if (j)
|
|
|
|
|
|
{
|
2000-10-11 12:24:43 +00:00
|
|
|
|
w = SCM_UNPACK (SCM_VELTS (exp)[SCM_BITVECTOR_LENGTH (exp) / SCM_LONG_BIT]);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
for (; j; j--)
|
|
|
|
|
|
{
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (w & 1 ? '1' : '0', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
w >>= 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('b', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_string:
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('a', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_byvect:
|
1998-10-18 12:46:27 +00:00
|
|
|
|
scm_putc ('y', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_uvect:
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('u', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_ivect:
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('e', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_svect:
|
1998-10-18 12:46:27 +00:00
|
|
|
|
scm_putc ('h', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
scm_putc ('l', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
case scm_tc7_fvect:
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('s', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_dvect:
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('i', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case scm_tc7_cvect:
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('c', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc ('(', port);
|
* arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
|
|
|
|
rapr1 (exp, base, 0, port, pstate);
|
* Makefile.in: Rebuilt.
* Makefile.am (libguile_la_SOURCES): Removed extchrs.c,
mbstrings.c.
(modinclude_HEADERS): Removed extchrs.h, mbstrings.h.
* unif.c (scm_vector_set_length_x): Don't handle multibyte
strings.
* tag.c (scm_utag_mb_string, scm_utag_mb_substring): Removed.
(scm_tag): Don't handle multibyte strings.
* read.c: Don't include mbstrings.h.
(scm_lreadr): Don't handle multibyte ports.
* kw.c: Don't include mbstrings.h.
* init.c: Don't include mbstrings.h.
(scm_boot_guile_1): Don't init mbstrings module.
* hash.c (scm_hasher): Don't handle mbstrings.
* gscm.c (gscm_run_scm): Don't init mbstrings module.
* gc.c (scm_gc_mark): Don't handle mbstrings.
(scm_gc_sweep): Likewise.
* eval.c (SCM_CEVAL): Don't handle mbstrings.
* eq.c (scm_equal_p): Use SCM_TYP7S, not SCM_TYP7SD.
* tags.h (SCM_TYP7SD): Removed.
(SCM_TYP7D): Removed.
(scm_tc7_mb_string): Removed.
(scm_tc7_mb_substring): Removed.
* print.c (scm_iprin1): Handle char printing directly. Don't
handle mbstrings.
Don't include "mbstrings.h".
* symbols.c (scm_intern_obarray_soft, scm_string_to_symbol,
scm_string_to_obarray_symbol, msymbolize): Don't set symbol's
multi-byte flag.
Don't include "mbstrings.h".
* symbols.h (SCM_SYMBOL_MULTI_BYTE_STRINGP): Removed.
(SCM_SYMBOL_SLOTS): Define as 4.
(SCM_ROSTRINGP): Use SCM_TYP7S, not SCM_TYP7SD.
* arbiters.c, backtrace.c, debug.c, dynl.c, eval.c, fluids.c,
gc.c, gsubr.c, ioext.c, kw.c, mallocs.c, numbers.c, ports.c,
print.c, read.c, regex-posix.c, root.c, srcprop.c, stackchk.c,
struct.c, threads.c, throw.c, unif.c, variable.c: Use new
("gen"-less) I/O function names.
* ports.c (scm_add_to_port_table): Don't set port's
representation.
* ports.h (scm_port_representation_type): Removed.
(scm_string_representation_type): Removed.
(struct scm_port_table ): Removed representation field.
(SCM_PORT_REPRESENTATION): Removed.
(SCM_SET_PORT_REPRESENTATION): Removed.
* genio.h: Use new function names.
* genio.c: Don't include "extchrs.h".
(scm_gen_putc, scm_gen_puts, scm_gen_write, scm_get_getc):
Removed.
(scm_putc, scm_puts, scm_lfwrite): No longer static.
(scm_getc): No longer static; handle line and column changes.
(scm_ungetc): Renamed from scm_gen_ungetc.
(scm_do_read_line): Renamed from scm_gen_read_line.
* libguile.h: Don't include "extchrs.h" or "mbstrings.h"
* extchrs.h, extchrs.c, mbstrings.h, mbstrings.c: Removed.
1997-10-15 17:18:32 +00:00
|
|
|
|
scm_putc (')', port);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2000-01-05 19:25:37 +00:00
|
|
|
|
SCM_DEFINE (scm_array_prototype, "array-prototype", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
|
(SCM ra),
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
|
"Returns an object that would produce an array of the same type as\n"
|
|
|
|
|
|
"@var{array}, if used as the @var{prototype} for\n"
|
|
|
|
|
|
"@code{make-uniform-array}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#define FUNC_NAME s_scm_array_prototype
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
int enclosed = 0;
|
|
|
|
|
|
SCM_ASRTGO (SCM_NIMP (ra), badarg);
|
|
|
|
|
|
loop:
|
2000-10-11 12:24:43 +00:00
|
|
|
|
switch SCM_TYP7 (ra)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
default:
|
2001-03-04 22:48:13 +00:00
|
|
|
|
badarg:SCM_WRONG_TYPE_ARG (1, ra);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_smob:
|
|
|
|
|
|
SCM_ASRTGO (SCM_ARRAYP (ra), badarg);
|
|
|
|
|
|
if (enclosed++)
|
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
|
ra = SCM_ARRAY_V (ra);
|
|
|
|
|
|
goto loop;
|
|
|
|
|
|
case scm_tc7_vector:
|
* ramap.c (scm_ra_matchp, scm_array_fill_int, racp, ramap_1,
ramap_2o, scm_array_index_map_x, raeql_1, scm_array_equal_p),
unif.c (scm_vector_set_length_x, scm_uniform_vector_length,
scm_array_p, scm_array_rank, scm_array_dimensions,
scm_enclose_array, scm_array_in_bounds_p, scm_uniform_vector_ref,
scm_cvref, scm_array_set_x, scm_array_contents, scm_array_to_list,
scm_array_prototype): Added case scm_tc7_wvect.
1997-08-24 03:29:35 +00:00
|
|
|
|
case scm_tc7_wvect:
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return SCM_EOL;
|
|
|
|
|
|
case scm_tc7_bvect:
|
|
|
|
|
|
return SCM_BOOL_T;
|
|
|
|
|
|
case scm_tc7_string:
|
2000-03-02 20:54:43 +00:00
|
|
|
|
return SCM_MAKE_CHAR ('a');
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_byvect:
|
2000-03-02 20:54:43 +00:00
|
|
|
|
return SCM_MAKE_CHAR ('\0');
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_uvect:
|
|
|
|
|
|
return SCM_MAKINUM (1L);
|
|
|
|
|
|
case scm_tc7_ivect:
|
|
|
|
|
|
return SCM_MAKINUM (-1L);
|
|
|
|
|
|
case scm_tc7_svect:
|
2000-12-08 17:08:34 +00:00
|
|
|
|
return scm_str2symbol ("s");
|
* configure.in: check for hstrerror.
* socket.c (scm_htons, scm_ntohs, scm_htonl, scm_ntohl): new
functions for network data conversion.
* numbers.c (scm_num2long, scm_num2longlong):
throw out-of-range instead of wrong-type-arg if appropriate.
(scm_iint2str): handle -2^31 correctly.
(scm_num2long): handle -2^31 bignum correctly.
(scm_num2long_long): rewrite the bigdig case: basically copied
from scm_num2long.
numbers.h: (SCM_BITSPERLONGLONG): deleted.
* unif.c (rapr1): use sprintf instead of intprint for unsigned
longs: intprint can't cope with large values.
* numbers.c (scm_num2ulong): check more consistently that the
input is not negative. if it is, throw out-of-range instead of
wrong-type-arg.
* ramap.c (scm_array_fill_int): don't limit fill to INUM for
uvect, ivect or llvect.
Check that fill doesn't overflow short uniform array.
* __scm.h: add another long to the definition of long_long and
ulong_long.
* unif.c (scm_raprin1): use 'l' instead of "long_long" in the
print representation of llvect. read can't handle more than
one character.
(scm_dimensions_to_uniform_array): make "fill" an optional argument
instead of a rest argument.
* tags.h (scm_tc7_llvect): wasn't defined anywhere, so use the free
tag 29 for now.
* __scm.h: don't mention LONGLONGS.
* unif.c, numbers.c, eq.c, gc.c, print.c, eval.c, ramap.c:
replace LONGLONGS with HAVE_LONG_LONGS as set by configure.
* net_db.c (scm_inet_aton): throw errors using the misc-error key
instead of system-error. inet_aton doesn't set errno.
system-error isn't right in gethost either, since it's throwing
the value of h_errno instead of errno. so:
(scm_host_not_found_key, scm_try_again_key,
scm_no_recovery_key, scm_no_data_key): new error keys.
(scm_resolv_error): new procedure, use the new keys.
(scm_gethost): call scm_resolv_error not scm_syserror_msg.
* error.c: (various): use scm_cons instead of scm_listify
to build short lists.
* boot-9.scm (read-hash-extend to set up arrays): add 'l' for
long_long uniform vectors.
* networking.scm (sethostent, setnetent, setprotoent, setservent):
take an optional argument STAYOPEN. default is #f.
* readline.c (scm_init_readline): set rl_readline_name to Guile,
to allow conditionals in .inputrc.
1999-11-18 22:36:28 +00:00
|
|
|
|
#ifdef HAVE_LONG_LONGS
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_llvect:
|
2000-12-08 17:08:34 +00:00
|
|
|
|
return scm_str2symbol ("l");
|
1996-07-25 22:56:11 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
case scm_tc7_fvect:
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
return scm_make_real (1.0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_dvect:
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
return scm_make_real (1.0 / 3.0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
case scm_tc7_cvect:
|
* __scm.h eq.c, eval.c, gc.c, hc.h, gh_data, hash.c, numbers.c,
numbers.h, objects.c, ramap.c, random.c, unif.c, unif.h: Extensive
rewrite of handling of real and complex numbers.
(SCM_FLOATS, SCM_SINGLES): These #ifdef conditionals have been
removed along with the support for floats. (Float vectors are
still supported.)
* unif.c (scm_makflo): Removed.
2000-03-14 06:42:56 +00:00
|
|
|
|
return scm_make_complex (0.0, 1.0);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
|
#undef FUNC_NAME
|
1996-07-25 22:56:11 +00:00
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
static SCM
|
2000-12-08 17:32:56 +00:00
|
|
|
|
array_mark (SCM ptr)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
|
return SCM_ARRAY_V (ptr);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
* __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes. (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
|
|
|
|
|
1996-07-25 22:56:11 +00:00
|
|
|
|
static scm_sizet
|
2000-12-08 17:32:56 +00:00
|
|
|
|
array_free (SCM ptr)
|
1996-07-25 22:56:11 +00:00
|
|
|
|
{
|
2000-09-26 21:53:49 +00:00
|
|
|
|
scm_must_free (SCM_ARRAY_MEM (ptr));
|
1996-07-25 22:56:11 +00:00
|
|
|
|
return sizeof (scm_array) + SCM_ARRAY_NDIM (ptr) * sizeof (scm_array_dim);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
scm_init_unif ()
|
|
|
|
|
|
{
|
2000-12-08 17:32:56 +00:00
|
|
|
|
scm_tc16_array = scm_make_smob_type ("array", 0);
|
|
|
|
|
|
scm_set_smob_mark (scm_tc16_array, array_mark);
|
|
|
|
|
|
scm_set_smob_free (scm_tc16_array, array_free);
|
|
|
|
|
|
scm_set_smob_print (scm_tc16_array, scm_raprin1);
|
|
|
|
|
|
scm_set_smob_equalp (scm_tc16_array, scm_array_equal_p);
|
1996-07-25 22:56:11 +00:00
|
|
|
|
scm_add_feature ("array");
|
* alist.c, arbiters.c, async.c, backtrace.c, boolean.c, chars.c,
continuations.c, debug-malloc.c, debug.c, dynl.c, dynwind.c,
environments.c, eq.c, error.c, eval.c, evalext.c, feature.c,
filesys.c, fluids.c, fports.c, gc.c, goops.c, guardians.c, hash.c,
hashtab.c, hooks.c, ioext.c, iselect.c, keywords.c, lang.c,
list.c, load.c, macros.c, modules.c, net_db.c, numbers.c,
objects.c, objprop.c, options.c, pairs.c, ports.c, posix.c,
print.c, procprop.c, procs.c, properties.c, ramap.c, random.c,
read.c, regex-posix.c, root.c, scmsigs.c, script.c, simpos.c,
socket.c, sort.c, srcprop.c, stackchk.c, stacks.c, stime.c,
strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c,
tag.c, threads.c, throw.c, unif.c, variable.c, vectors.c,
version.c, vports.c, weaks.c: Makes sure the snarfer output
inclusion is disabled when the snarfer is run on the file. Thanks
to Lars J. Aas!
* Makefile.am: Install guile-procedures.txt in version-specific
directory to enable multiple installed guile versions. Suggested
by Karl M. Hegbloom <karlheg@debian.org, patch by Matthias Koeppe.
2000-11-17 16:25:05 +00:00
|
|
|
|
#ifndef SCM_MAGIC_SNARFER
|
2000-04-21 14:16:44 +00:00
|
|
|
|
#include "libguile/unif.x"
|
* alist.c, arbiters.c, async.c, backtrace.c, boolean.c, chars.c,
continuations.c, debug-malloc.c, debug.c, dynl.c, dynwind.c,
environments.c, eq.c, error.c, eval.c, evalext.c, feature.c,
filesys.c, fluids.c, fports.c, gc.c, goops.c, guardians.c, hash.c,
hashtab.c, hooks.c, ioext.c, iselect.c, keywords.c, lang.c,
list.c, load.c, macros.c, modules.c, net_db.c, numbers.c,
objects.c, objprop.c, options.c, pairs.c, ports.c, posix.c,
print.c, procprop.c, procs.c, properties.c, ramap.c, random.c,
read.c, regex-posix.c, root.c, scmsigs.c, script.c, simpos.c,
socket.c, sort.c, srcprop.c, stackchk.c, stacks.c, stime.c,
strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c,
tag.c, threads.c, throw.c, unif.c, variable.c, vectors.c,
version.c, vports.c, weaks.c: Makes sure the snarfer output
inclusion is disabled when the snarfer is run on the file. Thanks
to Lars J. Aas!
* Makefile.am: Install guile-procedures.txt in version-specific
directory to enable multiple installed guile versions. Suggested
by Karl M. Hegbloom <karlheg@debian.org, patch by Matthias Koeppe.
2000-11-17 16:25:05 +00:00
|
|
|
|
#endif
|
1996-07-25 22:56:11 +00:00
|
|
|
|
}
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
|
End:
|
|
|
|
|
|
*/
|