1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
Commit graph

20436 commits

Author SHA1 Message Date
Andy Wingo
3fcc0eb27b Commit updates from newest autoconf
* ABOUT-NLS:
* build-aux/config.rpath: These files were overwritten by
re-bootstrapping with the newest autoconf.  OK computer!
2021-02-25 16:08:02 +01:00
Andy Wingo
03448b289d 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.
2021-02-25 16:07:47 +01:00
Andy Wingo
a758ba075a Fix read-syntax on vectors and arrays
* module/ice-9/read.scm (%read): Strip annotations from reading
the array elements.
2021-02-25 16:07:47 +01:00
Andy Wingo
0cc7991855 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.
2021-02-25 09:33:15 +01:00
Andy Wingo
9ade45097c 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.
2021-02-24 20:38:14 +01:00
Andy Wingo
e054504fd4 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.
2021-02-24 16:01:02 +01:00
Andy Wingo
1711608f15 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.
2021-02-24 12:02:35 +01:00
Andy Wingo
a04a024f20 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.
2021-02-21 22:09:41 +01:00
Andy Wingo
1bba859000 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.
2021-02-21 11:35:12 +01:00
Andy Wingo
50d3dd83f0 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.
2021-02-21 11:13:20 +01:00
Andy Wingo
3d8397c11d 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.
2021-02-21 11:05:27 +01:00
Andy Wingo
2edf91d51c 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.
2021-02-20 20:19:34 +01:00
Andy Wingo
064b394d5a Use lists instead of string ports to accumulate results
* module/ice-9/read.scm (read): Use lists, like read-delimited does.
  About 30% faster.
2021-02-17 15:50:10 +01:00
Andy Wingo
7244461a11 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.
2021-02-17 15:24:34 +01:00
Andy Wingo
6353b448cc Improve read error reporting
* module/ice-9/read.scm (read): Issue properly formatted read-errors, as
  users expect.
2021-02-17 14:54:53 +01:00
Andy Wingo
71e53d73fe Scheme read respects "positions" reader option
* module/ice-9/read.scm (read): Don't add source positions if the option
  is off.
2021-02-17 12:14:15 +01:00
Andy Wingo
beac6a3e29 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.
2021-02-17 12:10:57 +01:00
Andy Wingo
5cd28ae0ac Micro-optimization to delimiter?
* module/ice-9/read.scm (read): Make sure we hit the "case"
  optimization.
2021-02-17 12:04:18 +01:00
Andy Wingo
b6df67fe06 Re-use string output port within read
* module/ice-9/read.scm (read): Just have one string output port during
  the read.
2021-02-17 11:55:53 +01:00
Andy Wingo
a194d04d11 Fix (ice-9 read) for #\"
* module/ice-9/read.scm (read): Fix #\ followed by a delimiter.
2021-02-14 22:17:54 +01:00
Andy Wingo
5275156b00 Fix (ice-9 read) for #!r6rs
* module/ice-9/read.scm (read): Fix read-directive.
2021-02-14 22:01:42 +01:00
Andy Wingo
40e4e3b2a4 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.
2021-02-13 22:36:05 +01:00
Ludovic Courtès
7f8149b4de build: Use 'AM_GNU_GETTEXT_VERSION'.
* configure.ac: Add 'AM_GNU_GETTEXT_VERSION', as required by Autoconf 2.70.
2021-02-06 22:13:24 +01:00
Michael Gran
56e3adefc9 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
2021-02-04 02:48:35 -08:00
Andy Wingo
f5b3506ece 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.
2021-02-03 23:02:27 +01:00
Andy Wingo
2e26538d6a 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.
2021-02-03 23:02:21 +01:00
Mike Gran
480d86df68 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):
2021-01-23 12:35:01 -08:00
Mike Gran
d6afb41192 don't test crypt if not present
* test-suite/tests/posix.test (crypt):  throw unsupported if crypt not presetnt
2021-01-23 12:10:22 -08:00
Mike Gran
cdcdd29e8e socket test should not throw unresolved outside of a test
* test-suite/tests/00-socket.test: don't throw at top level
2021-01-23 10:00:07 -08:00
Michael Gran
54fe8e83d9 add test for setsockopt
* test-suite/tests/00-socket.test (setsockopt AF_INET): new test
2021-01-23 09:54:59 -08:00
Michael Gran
75b0db1a28 getsockopt may return garbage for parameters < sizeof(int)
Uninitialized variable.

* libguile/socket.c (scm_getsockopt): zeroize arguments before use
2021-01-21 19:35:15 -08:00
Michael Gran
91d4d31184 socket test should not throw unresolved outside of a test
* test-suite/tests/00-socket.test: don't throw unresolved outside of a
    test
2021-01-21 15:35:53 -08:00
Michael Gran
c65154ac69 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
2021-01-21 15:35:43 -08:00
Michael Gran
9baa2e9e58 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
2021-01-21 15:35:34 -08:00
Michael Gran
efecac1c7d 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
2021-01-21 15:35:09 -08:00
Michael Gran
449b9bd5e1 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
2021-01-21 15:34:03 -08:00
Michael Gran
d3f7a1d0b7 Need Guile and Windows types for the declarations posix-w32
* libguile/posix-w32.h: include scm.h and windows.h
2021-01-21 15:33:52 -08:00
Michael Gran
c5faaf50cf missing includes for list.h
* libguile/loader.c: include list.h
* libguile/stime.c: include list.h
2021-01-21 15:33:43 -08:00
Michael Gran
dd97382d9a 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
2021-01-21 15:33:06 -08:00
Michael Gran
93b8ab2994 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
2021-01-21 15:32:45 -08:00
Michael Gran
0d80eb23e2 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
2021-01-21 15:32:33 -08:00
Michael Gran
efb37b954e skip compile test when pause not available
* test-suite/standalone/test-guild-compile: abort if pause
    does not exist
2021-01-21 15:32:06 -08:00
Michael Gran
50da05835a for socket test, don't presume TMP is usable
* test-suite/tests/00-socket.test: don't abort when unable to change
    into tmpdir
2021-01-21 15:30:09 -08:00
Michael Gran
fe505e1a2a 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
2021-01-21 14:32:53 -08:00
Michael Gran
1a6eaba436 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
2021-01-21 10:41:10 -08:00
Michael Gran
32bf48e4b7 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.
2021-01-21 10:33:08 -08:00
Andy Wingo
c67cbc501f Replace stftime gnulib module with nstrftime
* lib/Makefile.am: Update to replace deprecated strftime module.
2021-01-21 11:15:08 +01:00
Andy Wingo
86e7a8b12b 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.
2021-01-20 23:03:56 +01:00
Andy Wingo
a91b95cca2 Update Gnulib to v0.1-4379-g2ef5a9b4b
Also bump required autoconf version to 2.64, as required by Gnulib.
2021-01-20 23:03:56 +01:00
Michael Gran
758b31994c Fix incorrect docstring of mkdtemp!
* libguile/filesys.c (scm_mkdtemp_x): fix docstring
2021-01-19 15:06:57 -08:00