platform/upstream/guile.git
4 years agodon't presume availability of gmp.pc upstream
Michael Gran [Wed, 3 Mar 2021 18:54:04 +0000 (10:54 -0800)]
don't presume availability of gmp.pc

This suggests moving the conditional that determines if mini-gmp is used
into scmconfig.h.

* configure.ac: replace PKG_CHECK_MODULES for gmp with AC_LIB_HAVE_LINKFLAGS
    Remove ENABLE_MINI_GMP define.  Also don't run mpz_inits test for
    --enable-mini-gmp.
* libguile/gen-scmconfig.c (main) [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_I_GSC_ENABLE_MINI_GMP
* libguile/bytevectors.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_ENABLE_MINI_GMP
* libguile/init.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_ENABLE_MINI_GMP
* libguile/numbers.c: include scm.h
    [SCM_ENABLE_MINI_GMP]: provide mpz_inits and mpz_clears
    [ENABLE_MINI_GMP]: prefer SCM_ENABLE_MINI_GMP to ENABLE_MINI_GMP
* libguile/numbers.h: include scm.h
* libguile/random.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_ENABLE_MINI_GMP
* libguile/socket.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_ENABLE_MINI_GMP

4 years agoFix reading #c32 vectors
Andy Wingo [Wed, 3 Mar 2021 21:59:27 +0000 (22:59 +0100)]
Fix reading #c32 vectors

* module/ice-9/read.scm (%read): Fix a wee typo.

4 years agoFix some srfi-105 parsing errors
Andy Wingo [Wed, 3 Mar 2021 21:56:58 +0000 (22:56 +0100)]
Fix some srfi-105 parsing errors

* module/ice-9/read.scm (%read): Fix parsing errors.

4 years agoFix length of \U hex escape in new reader
Andy Wingo [Wed, 3 Mar 2021 21:44:30 +0000 (22:44 +0100)]
Fix length of \U hex escape in new reader

* module/ice-9/read.scm (%read): \U escape is 6 digits long.

4 years agoRemove read extension support from primitive-read
Andy Wingo [Wed, 3 Mar 2021 21:30:49 +0000 (22:30 +0100)]
Remove read extension support from primitive-read

* libguile/read.c (scm_read_sharp_extension): Remove.
(scm_read_sharp): Adapt.

4 years agoMore read.c simplifications
Andy Wingo [Wed, 3 Mar 2021 21:22:56 +0000 (22:22 +0100)]
More read.c simplifications

* libguile/read.c: Use "return EXPR" instead of "return (EXPR)".  Avoid
passing around line and column info, as we don't use it any more.

4 years agoprimitive-read handles only default reader options
Andy Wingo [Wed, 3 Mar 2021 21:17:16 +0000 (22:17 +0100)]
primitive-read handles only default reader options

* libguile/read.c: Remove support for all non-default reader options.
Also remove support for source positions.  The idea is that
primitive-read should just be a stripped-down, easy-to-understand reader
that is enough to bootstrap the C reader.  Probably more refactoring
will follow.

4 years agoScheme reader fully replaces C reader
Andy Wingo [Wed, 3 Mar 2021 20:41:28 +0000 (21:41 +0100)]
Scheme reader fully replaces C reader

* libguile/read.h:
* libguile/read.c (scm_primitive_read): New name for C reader.
(scm_read): Call current value of "read" variable.
(scm_init_read): Initialize "read" binding to "primitive-read".
Replaced later in boot-9.

4 years agoFix bug in new array reader
Daniel Llorens [Wed, 3 Mar 2021 17:40:39 +0000 (18:40 +0100)]
Fix bug in new array reader

* module/ice-9/read.scm (read-array): Return pair for dimension when len
  is given; single number is lbnd for list->typed-array.
* test-suite/tests/arrays.test: More test cases for the reader.

4 years agoRead-in-scheme replaces boot "read" definition
Andy Wingo [Tue, 2 Mar 2021 20:54:42 +0000 (21:54 +0100)]
Read-in-scheme replaces boot "read" definition

Instead of defining a separate module, given that "read" calls are quite
all over the place, we're just going to replace the boot "read" binding
with read.scm.  This way, we'll be able to remove support for reader
options in the boot reader, as it will only ever be used for a finite
set of files.

* NEWS: Update.
* module/Makefile.am (ice-9/boot-9.go): Depend on read.scm.
(SOURCES):
* am/bootstrap.am (SOURCES): Don't build a ice-9/read.go, as we include
it.
* module/ice-9/boot-9.scm (read-syntax): Define here, as "include" now
uses it.
(read-hash-procedures, read-hash-procedure, read-hash-extend): New
procedures.  Will replace C variants.
(read, read-syntax): Include read.scm to define these.
* module/ice-9/psyntax-pp.scm (include): Regenerate.
* module/ice-9/psyntax.scm (include): Use read-syntax, so we get better
source information.
* module/ice-9/read.scm (let*-values): New local definition, to avoid
loading srfi-11.
(%read): Use list->typed-array instead of u8-list->bytevector.
* module/language/scheme/spec.scm: Remove (ice-9 read) import;
read-syntax is there in the boot environment

4 years agoRelax srfi-105 source expectations
Andy Wingo [Wed, 3 Mar 2021 16:08:12 +0000 (17:08 +0100)]
Relax srfi-105 source expectations

* test-suite/tests/srfi-105.test ("curly-infix"): For { EXPR }, allow
the source to be at the { rather than at EXPR.

4 years agoFix unterminated #!...!# error message in Scheme reader
Andy Wingo [Wed, 3 Mar 2021 15:20:53 +0000 (16:20 +0100)]
Fix unterminated #!...!# error message in Scheme reader

* module/ice-9/read.scm (%read): Tweak "unterminated block constant"
error to be more compatible with C reader.

4 years agoFix reading neoteric exprs in Scheme reader
Andy Wingo [Wed, 3 Mar 2021 15:20:24 +0000 (16:20 +0100)]
Fix reading neoteric exprs in Scheme reader

* module/ice-9/read.scm (%read): Call the inner reader, not the outer
reader.

4 years agoFix reader extensions in Scheme reader
Andy Wingo [Wed, 3 Mar 2021 15:19:57 +0000 (16:19 +0100)]
Fix reader extensions in Scheme reader

* module/ice-9/read.scm (%read): Fix invocation of hash procedure.

4 years agoInvalid charset at EOF does not cause decoding error
Andy Wingo [Wed, 3 Mar 2021 15:05:07 +0000 (16:05 +0100)]
Invalid charset at EOF does not cause decoding error

* libguile/ports.c (peek_iconv_codepoint): If the input has no bytes,
there's little point in raising a decoding error here.  Therefore remove
the needless iconv acquisition, harmonising with suspendable-ports.
* test-suite/tests/ports.test ("port-encoding"): Update test to include
some input so that the exception gets raised.

4 years agoRemove textual-ports include from (ice-9 read)
Andy Wingo [Mon, 1 Mar 2021 19:56:59 +0000 (20:56 +0100)]
Remove textual-ports include from (ice-9 read)

* module/ice-9/read.scm: We'll be loading this file early, so avoid
extraneous deps.

4 years agoimprove autoconfigury for minigmp
Michael Gran [Tue, 2 Mar 2021 06:57:30 +0000 (22:57 -0800)]
improve autoconfigury for minigmp

* configure.ac: add SCM_I_GSC_ENABLE_MINI_GMP var and rename
    GUILE_MINI_GMP to ENABLE_MINI_GMP
* libguile/bytevectors (GUILE_MINI_GMP): rename to ENABLE_MINI_GMP
* libguile/gen-scmconfig.c: renamed GUILE_MINI_GMP to ENABLE_MINI_GMP.
    rename GUILE_MINI_GMP to SCM_ENABLE_MINI_GMP
* libguile/gen-scmconfig.h: add SCM_I_GSC_ENABLE_MINI_GMP
* libguile/init.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP
* libguile/numbers.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP
* libguile/numbers.h: include scmconfig.h
    rename GUILE_MINI_GMP to SCM_ENABLE_MINI_GMP
* libguile/random.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP
* libguile/socket.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP
* libguile.h [GUILE_MINI_GMP]: prefer SCM_ENABLE_MINI_GMP

4 years agoEnable option to prefer mini-gmp over libgmp
Michael Gran [Sat, 6 Feb 2021 08:36:56 +0000 (00:36 -0800)]
Enable option to prefer mini-gmp over libgmp

* configure.ac: rework gmp library detection. Add new flag.
* libguile.h: modify gmp header inclusion
* libguile/Makefile.am: add mini-gmp.[ch] files
* libguile/bytevectors.c: add mini-gmp headers
* libguile/gen-scmconfig.c: new #include variable GUILE_MINI_GMP
* libguile/init.c: add mini-gmp header
* libguile/mini-gmp.c: new file
* libguile/mini-gmp.h: new file
* libguile/numbers.c: add fallback for missing mpz_get_d_2exp
* libguile/numbers.h: yse mini-gmp header
* libguile/random.c: use mini-gmp header
* libguile/socket.c: use mini-gmp header

4 years agoFix another typo in routine reading arrays
Daniel Llorens [Tue, 2 Mar 2021 14:12:20 +0000 (15:12 +0100)]
Fix another typo in routine reading arrays

* module/ice-9/read.scm: As stated.
* test-suite/tests/arrays.test: Test a fixed case.

4 years agoFix bug reading arrays with lengths
Andy Wingo [Tue, 2 Mar 2021 13:29:34 +0000 (14:29 +0100)]
Fix bug reading arrays with lengths

* module/ice-9/read.scm (%read): Fix typo.

4 years agoUpdate NEWS
Andy Wingo [Mon, 1 Mar 2021 19:17:36 +0000 (20:17 +0100)]
Update NEWS

* NEWS: Start updating for new release.

4 years agoFix Scheme read without source positions
Andy Wingo [Sun, 28 Feb 2021 19:54:40 +0000 (20:54 +0100)]
Fix Scheme read without source positions

* module/ice-9/read.scm (read): Fix annotate when positions are
disabled.

4 years agoShunt syntax-sourcev to (system syntax internal)
Andy Wingo [Thu, 25 Feb 2021 15:07:10 +0000 (16:07 +0100)]
Shunt syntax-sourcev to (system syntax internal)

* module/ice-9/boot-9.scm: Add syntax-sourcev to hidden bindings.

4 years agoread-syntax uses vector source representation
Andy Wingo [Thu, 25 Feb 2021 15:05:52 +0000 (16:05 +0100)]
read-syntax uses vector source representation

* module/ice-9/read.scm (read-syntax): Switch to sourcev format.

4 years agoPsyntax uses sourcev internally
Andy Wingo [Thu, 25 Feb 2021 15:06:43 +0000 (16:06 +0100)]
Psyntax uses sourcev internally

* module/ice-9/psyntax.scm: Use the vector representation of source
properties internally.  We have to convert to alists when going to
Tree-IL, but this will be in harmony with syntax objects once the reader
switches to vectors too.
* module/ice-9/psyntax-pp.scm: Regenerate.

4 years agoAssembler writes vector source properties
Andy Wingo [Thu, 25 Feb 2021 15:06:09 +0000 (16:06 +0100)]
Assembler writes vector source properties

* module/system/vm/assembler.scm (intern-constant, link-data): Write the
vector representation of source instead of the alist.  Saves a lot of
heap size, object file size, and init time when serializing syntax
objects with source.

4 years agoAdd syntax-sourcev
Andy Wingo [Thu, 25 Feb 2021 14:15:03 +0000 (15:15 +0100)]
Add syntax-sourcev

* libguile/syntax.c (sourcev_to_props, props_to_sourcev)
(scm_syntax_source, scm_syntax_sourcev): Add alternate source
representation for syntax objects.

4 years agoOptimize run-time init and relocation procedure
Andy Wingo [Thu, 25 Feb 2021 13:53:13 +0000 (14:53 +0100)]
Optimize run-time init and relocation procedure

* module/system/vm/assembler.scm (<asm>, make-assembler)
(intern-constant, emit-init-constants): Instead of loading a dependent
value each time it's needed in the relocation procedure, eagerly patch
values when they are created.  Allows keeping values in registers, which
decreases code size.

4 years agoCommit updates from newest autoconf
Andy Wingo [Thu, 25 Feb 2021 09:26:08 +0000 (10:26 +0100)]
Commit updates from newest autoconf

* ABOUT-NLS:
* build-aux/config.rpath: These files were overwritten by
re-bootstrapping with the newest autoconf.  OK computer!

4 years agoRead Scheme via read-syntax
Andy Wingo [Wed, 24 Feb 2021 19:47:28 +0000 (20:47 +0100)]
Read Scheme via read-syntax

* module/language/scheme/spec.scm: Use read-syntax.
* test-suite/tests/dwarf.test: Adapt expected source locations.
* am/bootstrap.am (SOURCES): Add ice-9/read.

4 years agoFix read-syntax on vectors and arrays
Andy Wingo [Thu, 25 Feb 2021 09:27:22 +0000 (10:27 +0100)]
Fix read-syntax on vectors and arrays

* module/ice-9/read.scm (%read): Strip annotations from reading
the array elements.

4 years agoEnsure that (syntax ()) results in ()
Andy Wingo [Thu, 25 Feb 2021 08:33:15 +0000 (09:33 +0100)]
Ensure that (syntax ()) results in ()

* module/ice-9/psyntax.scm: Add a special case for ().  There are
already special cases for pairs, vectors, etc; the issue is that with
read-syntax, the () might be come into psyntax as an annotated syntax
object, which here we would want to strip, to preserve the invariant to
psyntax users that all lists are unwrapped.

4 years agoFix module scoping for datum->syntax with no identifier
Andy Wingo [Wed, 24 Feb 2021 19:38:14 +0000 (20:38 +0100)]
Fix module scoping for datum->syntax with no identifier

* module/ice-9/psyntax.scm: With the new behavior of datum->syntax which
allows #f for the lexical context, we have the question of what module
to attach to these newly created syntax objects.  In that case we'll
mark down #f as the module, indicating that we know nothing.  We have to
extend a number of other cases to default to the expander's idea of the
current module, if a syntax object has no module scope.

Also, change datum->syntax to attach the empty wrap, not the top wrap.
Attaching the top wrap leads to multiply applying the top mark, as you
recurse into subexpressions.

4 years agoRemove top-marked? optimization from psyntax
Andy Wingo [Wed, 24 Feb 2021 15:01:02 +0000 (16:01 +0100)]
Remove top-marked? optimization from psyntax

* module/ice-9/psyntax.scm (strip): It used to be that terms in the
source program could have a "top" mark, and when stripping marks we'd
stop recursing when we see an expression with the top mark.  This had
the good effect that source programs could contain quoted syntax
objects, or quoted objects with shared structure -- in theory anyway.
In practice the compiler didn't support objects with shared structure.
Anyway when we switch to "read-syntax", quoted expressions can contain
syntax objects introduced by the reader, which naturally we would want
to strip away in a (quote FOO) form.  Therefore we remove the
top-marked? optimization.

4 years agoAdd quote-syntax
Andy Wingo [Wed, 24 Feb 2021 11:01:04 +0000 (12:01 +0100)]
Add quote-syntax

* module/ice-9/psyntax.scm (quote-syntax): New core form.  Usually the
  expander will unwrap all syntax objects from the input term.  However
  sometimes you want to preserve a syntax object, as a datum.  That's
  when you want quote-syntax.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/local-eval.scm (identifier-syntax-from-box): Use
  quote-syntax instead of our datum->syntax trick, which relied on
  psyntax's special treatment of the top mark.

4 years agoImplement read-syntax
Andy Wingo [Sun, 21 Feb 2021 19:48:15 +0000 (20:48 +0100)]
Implement read-syntax

* doc/ref/api-macros.texi (Syntax Case): Update documentation for
  datum->syntax.
* module/ice-9/psyntax.scm (datum->syntax): Use #:source keyword for
  source location info instead of an optional, and allow an alist.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/read.scm (%read, read): Refactor to allow read and
  read-syntax to share an implementation.
  (read-syntax): New function.

4 years agoDocument datum->syntax extensions
Andy Wingo [Sun, 21 Feb 2021 10:27:32 +0000 (11:27 +0100)]
Document datum->syntax extensions

* doc/ref/api-macros.texi (Syntax Case): Document that template-id can
  be false, and document srcloc.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (syntax?): Allow the lexical context to be
  null.  Allow srcloc to be a source properties alist.  Inspired by
  Racket.

4 years agoAdapt uses of make-syntax to preserve syntax
Andy Wingo [Sat, 20 Feb 2021 20:16:42 +0000 (21:16 +0100)]
Adapt uses of make-syntax to preserve syntax

* module/ice-9/psyntax.scm (datum->syntax): Add an additional optional
  argument, to allow callers to provide source annotation information.
* module/ice-9/psyntax-pp.scm: Regenerate.

4 years agopsyntax preserves source via syntax objects
Andy Wingo [Sat, 20 Feb 2021 19:56:47 +0000 (20:56 +0100)]
psyntax preserves source via syntax objects

* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (wrap, source-wrap): Preserve source via
  syntax objects.

4 years agoSyntax objects have "source" field
Andy Wingo [Sat, 20 Feb 2021 19:19:34 +0000 (20:19 +0100)]
Syntax objects have "source" field

* libguile/syntax.c (scm_make_syntax): Add optional "source" argument.
  Note that this function is internal.
  (scm_syntax_source): New function, replacing definition in boot-9.scm.
* libguile/syntax.h: Add new declarations.
* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm (source-annotation): For syntax objects, the
  source annotation comes direct from the syntax object.
* module/system/vm/assembler.scm (link-data, intern-constant): Write
  5-word syntax objects.

4 years agoUse lists instead of string ports to accumulate results
Andy Wingo [Wed, 17 Feb 2021 14:50:10 +0000 (15:50 +0100)]
Use lists instead of string ports to accumulate results

* module/ice-9/read.scm (read): Use lists, like read-delimited does.
  About 30% faster.

4 years agoFix read.scm bugs related to nonstandard reader options
Andy Wingo [Wed, 17 Feb 2021 14:21:39 +0000 (15:21 +0100)]
Fix read.scm bugs related to nonstandard reader options

* module/ice-9/read.scm (compute-reader-options): Fix handling of reader
  options, inline and otherwise.

4 years agoImprove read error reporting
Andy Wingo [Wed, 17 Feb 2021 13:54:53 +0000 (14:54 +0100)]
Improve read error reporting

* module/ice-9/read.scm (read): Issue properly formatted read-errors, as
  users expect.

4 years agoScheme read respects "positions" reader option
Andy Wingo [Wed, 17 Feb 2021 11:14:15 +0000 (12:14 +0100)]
Scheme read respects "positions" reader option

* module/ice-9/read.scm (read): Don't add source positions if the option
  is off.

4 years agoMore read micro-optimizations
Andy Wingo [Wed, 17 Feb 2021 11:10:57 +0000 (12:10 +0100)]
More read micro-optimizations

* module/ice-9/read.scm (read): Use R5RS read-char, peek-char,
  write-char rather than (ice-9 textual-ports) wrappers, because the
  latter are expressed in terms of the former.

4 years agoMicro-optimization to delimiter?
Andy Wingo [Wed, 17 Feb 2021 11:04:18 +0000 (12:04 +0100)]
Micro-optimization to delimiter?

* module/ice-9/read.scm (read): Make sure we hit the "case"
  optimization.

4 years agoRe-use string output port within read
Andy Wingo [Wed, 17 Feb 2021 10:55:53 +0000 (11:55 +0100)]
Re-use string output port within read

* module/ice-9/read.scm (read): Just have one string output port during
  the read.

4 years agoFix (ice-9 read) for #\"
Andy Wingo [Sun, 14 Feb 2021 21:17:54 +0000 (22:17 +0100)]
Fix (ice-9 read) for #\"

* module/ice-9/read.scm (read): Fix #\ followed by a delimiter.

4 years agoFix (ice-9 read) for #!r6rs
Andy Wingo [Sun, 14 Feb 2021 21:01:42 +0000 (22:01 +0100)]
Fix (ice-9 read) for #!r6rs

* module/ice-9/read.scm (read): Fix read-directive.

4 years agoAdd "read" implementation in Scheme
Andy Wingo [Sat, 13 Feb 2021 21:22:33 +0000 (22:22 +0100)]
Add "read" implementation in Scheme

* module/Makefile.am (SOURCES): Add ice-9/read.
* module/ice-9/read.scm: New file.  The idea is to move the compiler to
  use this "read", after proving that it does the same as C.  Then we
  can switch to read-syntax that returns syntax objects with source
  locations, allowing us to annotate any datum.

4 years agobuild: Use 'AM_GNU_GETTEXT_VERSION'.
Ludovic Courtès [Sat, 6 Feb 2021 21:13:24 +0000 (22:13 +0100)]
build: Use 'AM_GNU_GETTEXT_VERSION'.

* configure.ac: Add 'AM_GNU_GETTEXT_VERSION', as required by Autoconf 2.70.

4 years agothe mkdtemp tests don't clean up the directories created
Michael Gran [Thu, 4 Feb 2021 10:48:35 +0000 (02:48 -0800)]
the mkdtemp tests don't clean up the directories created

The tests erroneously try to rmdir the template names, not the
names of the directories created.

* test-suite/tests/filesys.test ("mkdtemp"): clean up temp directories,
    and not their templates

4 years agoOptimize eof-object?
Andy Wingo [Wed, 3 Feb 2021 21:52:54 +0000 (22:52 +0100)]
Optimize eof-object?

* module/language/cps/types.scm (constant-type): Add case for EOF.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect+exception-free-primitives*): Add case for eof-object?.
  (eof-object?): Expand to eq? on the-eof-object.

4 years agoReplace libltdl with raw dlopen, dlsym
Andy Wingo [Fri, 22 Jan 2021 15:39:11 +0000 (16:39 +0100)]
Replace libltdl with raw dlopen, dlsym

* NEWS: Update.
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Add system/foreign-library.scm.
* configure.ac: Replace ltdl check with -ldl check.
* libguile/dynl.c: Rewrite to just expose core dlopen / dlsym / etc to a
  helper Scheme module.
  (scm_dynamic_link, scm_dynamic_pointer, scm_dynamic_function)
  (scm_dynamic_object_p, scm_dynamic_call): Rewrite in terms of (system
  foreign-library).
* libguile/extensions.c (load_extension): Avoid scm_dynamic_call.
* module/system/foreign-library.scm: New file.
* module/oop/goops.scm (<dynamic-object>): Hackily export
  <foreign-library> instead of a class here.
* doc/ref/api-foreign.texi (Foreign Function Interface): Rewrite to only
  document the new interfaces.  Eventually we will deprecate
  dynamic-link and friends.
* doc/ref/guile.texi (API Reference): Move Foreign Objects after Foreign
  Function Interface.  Seems there should be some closer relationship
  but this will do for now.
* doc/ref/tour.texi (Putting Extensions into Modules):
* doc/ref/libguile-parallel.texi (Parallel Installations): Update for
  rename of Modules and Extensions to Foreign Extensions.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_dynamic_unlink): Deprecate.
* libguile/guile.c: Remove ltdl include.
* test-suite/tests/foreign.test: Update tests to use new API, and update
  error expectations.

4 years agostrptime test shouldn't presume that initial whitespace is ignored
Mike Gran [Sat, 23 Jan 2021 20:35:01 +0000 (12:35 -0800)]
strptime test shouldn't presume that initial whitespace is ignored

As far as I can tell, ignoring initial whitespace is not required by POSIX.

* test-suite/tests/time.test (strptime tests):

4 years agodon't test crypt if not present
Mike Gran [Sat, 23 Jan 2021 20:10:22 +0000 (12:10 -0800)]
don't test crypt if not present

* test-suite/tests/posix.test (crypt):  throw unsupported if crypt not presetnt

4 years agosocket test should not throw unresolved outside of a test
Mike Gran [Sat, 23 Jan 2021 18:00:07 +0000 (10:00 -0800)]
socket test should not throw unresolved outside of a test

* test-suite/tests/00-socket.test: don't throw at top level

4 years agoadd test for setsockopt
Michael Gran [Fri, 22 Jan 2021 18:05:26 +0000 (10:05 -0800)]
add test for setsockopt

* test-suite/tests/00-socket.test (setsockopt AF_INET): new test

4 years agogetsockopt may return garbage for parameters < sizeof(int)
Michael Gran [Wed, 30 Dec 2020 23:16:02 +0000 (15:16 -0800)]
getsockopt may return garbage for parameters < sizeof(int)

Uninitialized variable.

* libguile/socket.c (scm_getsockopt): zeroize arguments before use

4 years agosocket test should not throw unresolved outside of a test
Michael Gran [Wed, 30 Dec 2020 14:00:35 +0000 (06:00 -0800)]
socket test should not throw unresolved outside of a test

* test-suite/tests/00-socket.test: don't throw unresolved outside of a
    test

4 years agoavoid a ports test when fcntl is not provided
Michael Gran [Wed, 30 Dec 2020 13:39:33 +0000 (05:39 -0800)]
avoid a ports test when fcntl is not provided

* test-suite/tests/ports.test (non blocking I/O): disable test when fcntl
    is not provided

4 years agostandalone tests require libgnu on DLL-based platforms
Michael Gran [Tue, 29 Dec 2020 10:09:35 +0000 (02:09 -0800)]
standalone tests require libgnu on DLL-based platforms

* test-suite/standalone/Makefile.am (test_conversion_LDADD): add libgnu
  (test_scm_to_latin1_string_LDADD): add libgnu
  (test_scm_values_LDADD): add libgnu
  (test_scm_c_bind_keyword_arguments): add libgnu
  (test_srfi_4_LDADD): add libgnu
  (libtest_extensions_la_LIBADD): add libgnu
  (test_with_guile_module_LDADD): add libgnu
  (test_scm_with_guile_LDADD): add libgnu
  (test_scm_spawn_thread_LDADD): add libgnu
  (test_pthread_create_LDADD): add libgnu
  (test_pthread_create_secondary_LDADD): add libgnu
  (test_smob_mark_LDADD): add libgnu
  (test_smob_mark_race_LDADD): add libgnu

4 years agoskip version test if git-version-gen can't compute version from git
Michael Gran [Mon, 28 Dec 2020 22:53:07 +0000 (14:53 -0800)]
skip version test if git-version-gen can't compute version from git

This might occur due to a shallow git clone.

* test-suite/tests/version.test: throw unsupported if version is unknown

4 years agoin null threads, don't define sigmask stub when pthread_sigmask does not exist
Michael Gran [Tue, 24 Nov 2020 01:30:13 +0000 (17:30 -0800)]
in null threads, don't define sigmask stub when pthread_sigmask does not exist

* libguile/gen-scmconfig.c (main) [HAVE_PTHREAD_SIGMASK]: new output
    define SCM_HAVE_PTHREAD_SIGMASK
* libguile/null-threads.h (scm_i_pthread_sigmask) [SCM_HAVE_PTHREAD_SIGMASK]:
    make inline function conditional on existence of pthread_sigmask

4 years agoNeed Guile and Windows types for the declarations posix-w32
Michael Gran [Mon, 28 Dec 2020 02:09:45 +0000 (18:09 -0800)]
Need Guile and Windows types for the declarations posix-w32

* libguile/posix-w32.h: include scm.h and windows.h

4 years agomissing includes for list.h
Michael Gran [Tue, 24 Nov 2020 02:41:57 +0000 (18:41 -0800)]
missing includes for list.h

* libguile/loader.c: include list.h
* libguile/stime.c: include list.h

4 years agotest-foreign-object-c should link libgnu
Michael Gran [Tue, 24 Nov 2020 02:43:06 +0000 (18:43 -0800)]
test-foreign-object-c should link libgnu

For MinGW, the foreign object test requires stubs provided by libgnu

* test-suite/standalone/Makefile.am (test_foreign_object_c_LDADD): add libgnu

4 years agofor dynamic-link tests, mingw needs to link to msvcrt
Michael Gran [Tue, 24 Nov 2020 03:20:54 +0000 (19:20 -0800)]
for dynamic-link tests, mingw needs to link to msvcrt

* test-suite/standalone/test-ffi: link msvcrt for mingw
* test-suite/standalone/test-foreign-object-scm: link msvcrt for mingw

4 years agoin command line encoding test don't presume extant UTF-8 locale
Michael Gran [Tue, 24 Nov 2020 03:21:25 +0000 (19:21 -0800)]
in command line encoding test don't presume extant UTF-8 locale

* test-suite/standalone/test-command-line-encoding: abort if
    locale is not UTF-8

4 years agoskip compile test when pause not available
Michael Gran [Tue, 24 Nov 2020 03:22:13 +0000 (19:22 -0800)]
skip compile test when pause not available

* test-suite/standalone/test-guild-compile: abort if pause
    does not exist

4 years agofor socket test, don't presume TMP is usable
Michael Gran [Tue, 24 Nov 2020 03:53:38 +0000 (19:53 -0800)]
for socket test, don't presume TMP is usable

* test-suite/tests/00-socket.test: don't abort when unable to change
    into tmpdir

4 years agoencoding test tries to delete a file that is not closed
Michael Gran [Wed, 23 Dec 2020 17:00:02 +0000 (09:00 -0800)]
encoding test tries to delete a file that is not closed

On Windows, deleting a file on an open port does not succeed

* test-suite/tests/ports.test ("%default-port-encoding, wrong encoding"):
  ensure port is closed before deleting

4 years agoUse mkdtemp to simplify repl server test
Michael Gran [Thu, 21 Jan 2021 18:41:10 +0000 (10:41 -0800)]
Use mkdtemp to simplify repl server test

* test-suite/tests/00-repl-server.test (make-tempdir): removed
  (call-with-repl-server): use mkdtemp instead of make-tempdir

4 years agoReplace mutating mkdtemp! with non-mutating mkdtemp
Michael Gran [Thu, 21 Jan 2021 17:37:49 +0000 (09:37 -0800)]
Replace mutating mkdtemp! with non-mutating mkdtemp

* doc/ref/posix.texi: replace mkdtemp! and scm_mkdtemp_x documentation
    with documentation for mkdtemp and scm_mkdtemp
* libguile/filesys.c (scm_mkdtemp_x): procedure mkdtemp! removed
    (scm_mkdtemp): new procedure mkdtemp
* libguile/filesys.h: Remove declaration for scm_mkdtemp_x.  New declaration
    scm_mkdtemp.
* test-suite/tests/filesys.test: Remove mkdtemp! tests.  Add tests
    for mkdtemp.

4 years agoReplace stftime gnulib module with nstrftime
Andy Wingo [Thu, 21 Jan 2021 10:15:08 +0000 (11:15 +0100)]
Replace stftime gnulib module with nstrftime

* lib/Makefile.am: Update to replace deprecated strftime module.

4 years agoUpdate environ_locale_charset gnulib patch
Andy Wingo [Wed, 20 Jan 2021 21:34:44 +0000 (22:34 +0100)]
Update environ_locale_charset gnulib patch

* gnulib-local/lib/localcharset.c.diff: Update to apply to current
  gnulib.  Lots of code duplication now, but oh well.
* lib/localcharset.c (environ_locale_charset): Update.
* lib/iconv_open-solaris.h:
* lib/iconv_open-osf.h:
* lib/iconv_open-irix.h:
* lib/iconv_open-hpux.h:
* lib/iconv_open-aix.h: Regenerate with gperf 3.1.

4 years agoUpdate Gnulib to v0.1-4379-g2ef5a9b4b
Andy Wingo [Wed, 20 Jan 2021 20:52:54 +0000 (21:52 +0100)]
Update Gnulib to v0.1-4379-g2ef5a9b4b

Also bump required autoconf version to 2.64, as required by Gnulib.

4 years agoFix incorrect docstring of mkdtemp!
Michael Gran [Tue, 19 Jan 2021 23:06:57 +0000 (15:06 -0800)]
Fix incorrect docstring of mkdtemp!

* libguile/filesys.c (scm_mkdtemp_x): fix docstring

4 years agoNew procedure mkdtemp! to create unique temporary directory
Michael Gran [Tue, 19 Jan 2021 13:00:49 +0000 (05:00 -0800)]
New procedure mkdtemp! to create unique temporary directory

* configure.ac (AC_CHECK_FUNCS): add mkdtemp! test
* doc/ref/posix.texi: document mkdtemp!
* libguile/filesys.c (scm_mkdtemp_x): new function
* libguile/filesys.h: new declaration for scm_mkdtemp_x
* test-suite/tests/filesys.test: add tests for mkdtemp!

Adapted from a patch by Rob Browning.

4 years agoMove declaration for scm_mkstemp to filesys.h
Michael Gran [Mon, 18 Jan 2021 16:40:27 +0000 (08:40 -0800)]
Move declaration for scm_mkstemp to filesys.h

The underlying function was moved to filesys.c in
073167ef7b803067bcc8be19925fac1a48577bd8 but the declaration didn't follow

* libguile/filesys.h: add declaration for scm_mkstemp
* libguile/posix.h: remove declaration for scm_mkstemp

4 years agoFix "display" typo in make-thread and begin-thread docs
Rob Browning [Sun, 17 Jan 2021 19:04:32 +0000 (13:04 -0600)]
Fix "display" typo in make-thread and begin-thread docs

* doc/ref/api-scheduling.texi (make-thread, begin-thread): fix "display"
  typo.

4 years agoscm_i_make_transcoded_port: fix mode for input/output ports
Rob Browning [Sun, 4 Oct 2020 19:05:29 +0000 (14:05 -0500)]
scm_i_make_transcoded_port: fix mode for input/output ports

* libguile/r6rs-ports.c (scm_i_make_transcoded_ports): make sure to
  include SCM_RDNG for input/output ports.

Thanks to Göran Weinholt for reporting the problem.

Closes: 41045
4 years ago(scheme base) member: return #f, not (), for no match
Rob Browning [Sun, 4 Oct 2020 15:43:09 +0000 (10:43 -0500)]
(scheme base) member: return #f, not (), for no match

* module/scheme/base.scm (member): Match the r7rs requirement, as assoc
  already does.

Thanks to Erik Dominikus for reporting the problem.

Closes: 43304
4 years agoReplace a line which was accidentally removed.
Asher Gordon [Sun, 12 Jul 2020 05:22:15 +0000 (01:22 -0400)]
Replace a line which was accidentally removed.

The line, part of the sentence above it in a comment, was accidentally
removed in commit b8d757732fae7c396d58327185f94e5d90846445 "Rationalize
include order in C files".

* libguile/guile.c: restore missing line.

[rlb@defaultvalue.org: augment commit message; add THANKS]

Closes: 42331
4 years agodoc: Fix composition describing scm_reverse_list_to_string
Rob Browning [Sat, 26 Sep 2020 22:26:19 +0000 (17:26 -0500)]
doc: Fix composition describing scm_reverse_list_to_string

* libguile/srfi-13.c (scm_reverse_list_to_string): Replace string->list
  with list->string in the composition explaning how it works.  Thanks
  to Andrey Ivanov for reporting the problem.

Closes: 34457
4 years agoDocument new interfaces
Andy Wingo [Tue, 12 Jan 2021 11:24:59 +0000 (12:24 +0100)]
Document new interfaces

* NEWS: Update.
* doc/ref/api-io.texi (Bytevector Ports): Add docs.

4 years agoDocument call-with-port
Andy Wingo [Tue, 12 Jan 2021 11:21:15 +0000 (12:21 +0100)]
Document call-with-port

* doc/ref/api-io.texi (Ports): Add docs.
* doc/ref/r6rs.texi (rnrs io ports): Remove docs.

4 years agoFinish call-with-port cleanup
Andy Wingo [Tue, 12 Jan 2021 11:17:55 +0000 (12:17 +0100)]
Finish call-with-port cleanup

* module/rnrs/io/ports.scm (call-with-port): Remove local definition.
* module/system/repl/server.scm (system): Call-with-port is imported
  via (ice-9 ports).

4 years agoAdd call-with-input-bytevector, call-with-output-bytevector
Andy Wingo [Tue, 12 Jan 2021 10:47:58 +0000 (11:47 +0100)]
Add call-with-input-bytevector, call-with-output-bytevector

* module/ice-9/binary-ports.scm (call-with-input-bytevector):
  (call-with-output-bytevector): New functions.
* module/ice-9/iconv.scm: Remove superfluous copies of
  call-with-output-string* and call-with-output-bytevector*, now that
  the former closes the port and the latter exists.
  (call-with-encoded-output-string): Adapt.
* module/web/uri.scm: Use (ice-9 iconv) instead of local
  bytevector/string conversion procedures.

4 years agoClose accumulating output ports after use
Andy Wingo [Tue, 12 Jan 2021 10:45:39 +0000 (11:45 +0100)]
Close accumulating output ports after use

* module/ice-9/ports.scm (call-with-port): New procedure, from r7rs.
  (call-with-input-file, call-with-output-file): Refactor to use
  call-with-port.
  (call-with-output-string): Close the string after normal exit.
* module/scheme/base.scm (scheme): Re-export call-with-port from base.

4 years agoBump copyright years for user-visible copyright messages
Andy Wingo [Thu, 7 Jan 2021 11:39:57 +0000 (12:39 +0100)]
Bump copyright years for user-visible copyright messages

* module/ice-9/command-line.scm (version-etc):
* module/scripts/compile.scm (show-version):
* module/system/repl/common.scm (*version*): Bump to 2021.

4 years agoBump version to 3.0.5 upstream/3.0.5
Andy Wingo [Thu, 7 Jan 2021 11:38:39 +0000 (12:38 +0100)]
Bump version to 3.0.5

* GUILE-VERSION (GUILE_MICRO_VERSION): Bump.

4 years agoUpdate NEWS
Andy Wingo [Thu, 7 Jan 2021 11:12:00 +0000 (12:12 +0100)]
Update NEWS

* NEWS: Update.

4 years agoMerge remote-tracking branch 'lightening/main'
Andy Wingo [Thu, 7 Jan 2021 10:48:30 +0000 (11:48 +0100)]
Merge remote-tracking branch 'lightening/main'

4 years agoMerge branch 'fix-shortening' into 'master'
Andy Wingo [Thu, 7 Jan 2021 10:05:57 +0000 (10:05 +0000)]
Merge branch 'fix-shortening' into 'master'

Fix jmp-shortening on x86 when target within instruction.

See merge request wingo/lightening!12

4 years agoFix jmp-shortening on x64 when target within instruction.
Andy Wingo [Thu, 7 Jan 2021 09:58:43 +0000 (10:58 +0100)]
Fix jmp-shortening on x64 when target within instruction.

* lightening/x86.c (jit_try_shorten): If the address is within the
  last instruction, don't shorten.  If the intstruction is a jump, we
  could elide it entirely in some cases, but we don't know if the user
  captured the PC before calling jit_patch_here.  Better to leave this
  to the user.

Thanks to Helmut Eller for the bug report and test case in
https://gitlab.com/wingo/lightening/-/issues/17.

4 years agoNew warnings: -Wuse-before-definition, -Wnon-idempotent-definition
Andy Wingo [Thu, 7 Jan 2021 09:15:32 +0000 (10:15 +0100)]
New warnings: -Wuse-before-definition, -Wnon-idempotent-definition

* module/ice-9/boot-9.scm (%auto-compilation-options): Add
  use-before-definition and non-idempotent-definition.
* module/language/tree-il/analyze.scm (<use-before-def-info>): New
  analysis info.
  (make-use-before-definition-analysis): New function.
  (goops-toplevel-definition): Move down.
  (unbound-variable-analysis, macro-use-before-definition): Remove, as
  they are subsumed by use-before-def.  There are some deprecated
  bindings though.
  (make-analyzer): Rework to allow for use-before-def analysis to handle
  multiple
* module/system/base/message.scm (%warning-types): Add handlers for the
  new warning types.
* test-suite/tests/tree-il.test: Add tests.
* doc/ref/api-evaluation.texi (Compilation): Update.

4 years agoFix source location bug for neoteric exprs introduced by refactoring
Andy Wingo [Thu, 10 Sep 2020 20:10:54 +0000 (22:10 +0200)]
Fix source location bug for neoteric exprs introduced by refactoring

* libguile/read.c (scm_read_expression): Ungetc after capturing the
  column.

4 years agoMove copy-tree to (ice-9 copy-tree); deprecate main binding
Andy Wingo [Thu, 10 Sep 2020 19:57:21 +0000 (21:57 +0200)]
Move copy-tree to (ice-9 copy-tree); deprecate main binding

* doc/ref/api-data.texi (List Constructors):
* doc/ref/api-utility.texi (Copying): Update docs to mention module.
* libguile.h: Remove trees.h inclusion.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  (DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Remove trees.c,
  trees.h, and related files.
* libguile/init.c (scm_i_init_guile): Remove trees.h and the
  scm_init_trees call.
* libguile/trees.c:
* libguile/trees.h: Remove.
* module/Makefile.am (SOURCES): Add ice-9/copy-tree.scm.
* module/ice-9/copy-tree.scm: New file.
* module/ice-9/deprecated.scm (copy-tree*): Export as copy-tree,
  proxying to (ice-9 copy-tree).
* module/system/repl/common.scm:
* module/web/client.scm:
* test-suite/tests/elisp.test:
* test-suite/tests/srfi-1.test:
* module/oop/goops/save.scm: Use (ice-9 copy-tree).
* test-suite/Makefile.am (SCM_TESTS): Add copy-tree.test.
* test-suite/tests/copy-tree.test: New file; test pulled from
  eval.test.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_copy_tree): Deprecate.

4 years agoUpdate NEWS
Andy Wingo [Sat, 5 Sep 2020 20:22:22 +0000 (22:22 +0200)]
Update NEWS

* NEWS: Update.
* doc/ref/api-evaluation.texi (Scheme Read): Remove copy option.