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

4291 commits

Author SHA1 Message Date
Mike Gran
5a1e78a278 On Cygwin, 'lib' DLLs use 'cyg' prefix
When using automake and libtool to build DLLs on Cygwin, libtool
will rename libXXX to cygXXX. 'load-foreign-library' should
emulate libltdl behavior and search for DLLs using that convention.

* module/system/foreign-library.scm (lib->cyg): new helper function
  (load-foreign-library): add rename-on-cygwin? option to rename
    libraries using Cygwin semantics
* test-suite/tests/foreign.test: new test section 'lib->cyg'
* doc/ref/api-foreign.text: document new rename-on-cygwin? option
    for load-foreign-library
2021-03-13 09:09:30 -08:00
Ricardo G. Herdt
23042a1ef9 Fix hash-table-merge! bug.
* module/srfi/srfi-69.scm : fold over second hash table.
2021-03-12 22:31:00 +01:00
Andrew Whatson
f591ad28f1 Fix suspendable implementation of 'get-bytevector-some!'
* module/ice-9/suspendable-ports.scm (get-bytevector-some!): Fix
  incorrect arguments to bytevector-copy!
2021-03-12 22:11:58 +01:00
Andy Wingo
e30ee90478 Revert "Handle CRLF and Unicode line endings in read-line"
This reverts commit 0f983e3db0.

After discussing with Mike we are going to punt the read-line changes
for now.  Open the port in O_TEXT mode if you want to chomp the CR in
CFLF sequences.
2021-03-12 22:08:16 +01:00
Mike Gran
0f983e3db0 Handle CRLF and Unicode line endings in read-line
* libguile/rdelim.c (scm_read_line): handle CRLF, LS and PS
* module/ice-9/suspendable-ports.scm (read-line): handle CRLF, LS, and PS
* module/web/http.scm (read-header-line): take advantage of CRLF in read-line
   (read-header): don't need to test for \return
* test-suite/tests/rdelim.test: new tests for read-line CRLF, LS and PS
* doc/ref/api-io.texi: update doc for read-line
2021-03-11 19:42:33 -08:00
Michael Gran
a744f98dcc ice-9 ftw: handle non-working inodes
* module/ice-9/ftw.scm (visited?-proc): accept filename for string hash
  (file-system-fold): use string hash if ino = 0
  (ftw): use new visited?-proc
* test-suite/tests/ftw.test (visited?-proc valid inodes): add filenames to visited?-proc calls
  (visited?-proc broken inodes): new tests
  (%top-srcdir): canonicalize-path
2021-03-11 10:46:35 -08:00
Michael Gran
c150044640 ice-9 ftw: handle missing getuid and getgid
* module/ice-9/ftw.scm (getuid-or-false, getgid-or-false): new macros
  (stat-dir-readable?-proc): don't overwrite arguments
  (ftw, nftw): use new macros
* test-suite/tests/ftw.test (test-EACCES): don't presume getuid exists
2021-03-11 10:46:24 -08:00
Andy Wingo
85433fc2b1 Add mkstemp; undocument mkstemp!
* doc/ref/posix.texi (File System): Update to document mkstemp only.
* libguile/filesys.c: Make a mkstemp that doesn't modify the input
template.  Instead the caller has to get the file name from
port-filename.
(scm_mkstemp): Use the new mkstemp to implement mkstemp!.  Can't
deprecate yet though as the replacement hasn't been there for long
enough.
* libguile/posix.c (scm_tempnam): Update to mention mkstemp instead.
* module/system/base/compile.scm (call-with-output-file/atomic): Use
mkstemp.
* test-suite/tests/posix.test:
* test-suite/tests/r6rs-files.test: Use mkstemp.
* NEWS: Update.
2021-03-10 20:40:10 +01:00
Linus
0bd7497b61 Write a proper vector-map and vector-for-each for (rnrs base)
* module/rnrs/base.scm (vector-map vector-for-each): Rewrite to not be
slow.
* NEWS: Update.
2021-03-09 21:10:04 +01:00
Andy Wingo
5046385df8 Document syntax-sourcev
* NEWS: Add doc link.
* doc/ref/api-macros.texi (Syntax Transformer Helpers): Document
syntax-sourcev.
* module/system/syntax.scm: Re-export syntax-sourcev.
2021-03-09 20:50:08 +01:00
Andy Wingo
cad6094cbc Fix reading #!!#
* module/ice-9/read.scm (%read): Fix reading #!!#.
* test-suite/tests/reader.test ("reading"): Add some test cases.
2021-03-07 20:17:58 +01:00
Michael Gran
1114122fbb tweak unknown hash object error in reader
This makes it match the other species of unknown hash object error
when reading number with radix.

* module/ice-9/read.scm (read-sharp): modified
2021-03-05 22:33:20 -08:00
Michael Gran
d6753e5af5 print token in error msg for unknown hash object
* module/ice-9/read.scm (read-number-and-radix): modified
2021-03-05 22:26:00 -08:00
Michael Gran
1ae9a8df3a Handle <eof> in reader's character escape sequences
* module/ice-9/read.scm (read-r6rs-hex-escape, read-fixed-hex-escape):
    modified
2021-03-05 22:24:40 -08:00
Andy Wingo
9fb550b945 Fix reading "#;", "'", and similar premature-EOF situations
* module/ice-9/read.scm (%read): Adjust how subexpressions are read to
error on EOF.  Improve the error message.
* test-suite/tests/reader.test ("#;"): Adapt expectation.
2021-03-05 21:06:04 +01:00
Andy Wingo
9897650f7a Fix reading of #true / #false
* module/ice-9/read.scm (%read): Fix bad argument order to unread-char.
2021-03-05 20:44:58 +01:00
Andy Wingo
2c3029e660 Syntax objects print with source locations
* module/system/syntax.scm (print-syntax): Print source locations.
2021-03-04 21:42:22 +01:00
Daniel Llorens
bd93eaf7cc Add docstring for array-shape 2021-03-04 14:35:50 +01:00
Andy Wingo
d904392885 Fix reading improper curly-infix expressions
* module/ice-9/read.scm (%read): A fix to last night's fix, to make
srfi-105.test pass.
2021-03-04 12:40:14 +01:00
Andy Wingo
eb5ffda6ce Fix reading #c32 vectors
* module/ice-9/read.scm (%read): Fix a wee typo.
2021-03-03 22:59:27 +01:00
Andy Wingo
ea86a5c6d2 Fix some srfi-105 parsing errors
* module/ice-9/read.scm (%read): Fix parsing errors.
2021-03-03 22:56:58 +01:00
Andy Wingo
94279414a8 Fix length of \U hex escape in new reader
* module/ice-9/read.scm (%read): \U escape is 6 digits long.
2021-03-03 22:44:30 +01:00
Daniel Llorens
9516a10ab3 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.
2021-03-03 18:40:39 +01:00
Andy Wingo
8edf1dc623 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
2021-03-03 17:08:55 +01:00
Andy Wingo
079800d682 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.
2021-03-03 16:22:56 +01:00
Andy Wingo
dba7669077 Fix reading neoteric exprs in Scheme reader
* module/ice-9/read.scm (%read): Call the inner reader, not the outer
reader.
2021-03-03 16:22:56 +01:00
Andy Wingo
816c8d23a1 Fix reader extensions in Scheme reader
* module/ice-9/read.scm (%read): Fix invocation of hash procedure.
2021-03-03 16:22:56 +01:00
Andy Wingo
c802ed4832 Remove textual-ports include from (ice-9 read)
* module/ice-9/read.scm: We'll be loading this file early, so avoid
extraneous deps.
2021-03-03 15:08:10 +01:00
Daniel Llorens
a4a5fbced3 Fix another typo in routine reading arrays
* module/ice-9/read.scm: As stated.
* test-suite/tests/arrays.test: Test a fixed case.
2021-03-02 15:12:20 +01:00
Andy Wingo
d69062daf1 Fix bug reading arrays with lengths
* module/ice-9/read.scm (%read): Fix typo.
2021-03-02 14:29:34 +01:00
Andy Wingo
93b82fca20 Fix Scheme read without source positions
* module/ice-9/read.scm (read): Fix annotate when positions are
disabled.
2021-02-28 20:54:40 +01:00
Andy Wingo
697f2b3ca1 Shunt syntax-sourcev to (system syntax internal)
* module/ice-9/boot-9.scm: Add syntax-sourcev to hidden bindings.
2021-02-25 21:26:43 +01:00
Andy Wingo
6c57b2af79 read-syntax uses vector source representation
* module/ice-9/read.scm (read-syntax): Switch to sourcev format.
2021-02-25 21:26:17 +01:00
Andy Wingo
18c09f0492 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.
2021-02-25 21:26:15 +01:00
Andy Wingo
7e01042337 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.
2021-02-25 21:24:59 +01:00
Andy Wingo
636ae1d510 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.
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