1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 13:00:26 +02:00
Commit graph

18442 commits

Author SHA1 Message Date
Ludovic Courtès
7d6f309ccd Treat 'SIG_IGN' as a pointer.
* libguile/posix.c (scm_system_star): Cast 'SIG_IGN' to
'scm_t_uintptr_t' and use 'scm_from_uintptr_t'.  This fixes an
'int-conversion' warning with GCC 6.2.
2017-03-01 19:58:31 +01:00
Ludovic Courtès
1107db3eb1 Document 'scm_to_uintptr_t' and 'scm_from_uintptr_t'.
* doc/ref/api-data.texi (Integers): Document them.
2017-03-01 19:56:55 +01:00
Ludovic Courtès
844b2cf758 Remove 'umask' calls from 'mkdir'.
Fixes <http://bugs.gnu.org/24659>.

* libguile/filesys.c (SCM_DEFINE): Remove calls to 'umask' when MODE is
unbound; instead, use 0777 as the mode.  Update docstring to clarify
this.
* doc/ref/posix.texi (File System): Adjust accordingly.
* NEWS: Mention it.
2017-03-01 19:54:31 +01:00
Andy Wingo
25652ff84c %port-encoding requires an open port
* libguile/ports.c (scm_sys_port_encoding)
  (scm_sys_set_port_encoding_x): Require an open port, to match 2.0
  behavior.
2017-03-01 19:52:17 +01:00
Mark H Weaver
b56b944920 http: Do not use 'eq?' to compare characters in parse-request-uri.
* module/web/http.scm (parse-request-uri): Use 'eqv?' to compare
characters.
2017-03-01 19:50:37 +01:00
Mark H Weaver
8f7ed8abf2 build: .x and .doc files depend on generated includes.
Fixes <https://bugs.gentoo.org/show_bug.cgi?id=590528>.

* libguile/Makefile.am (BUILT_INCLUDES): New variable.
(BUILT_SOURCES): Put generated .h to BUILT_INCLUDES.
(DOT_X_FILES, EXTRA_DOT_X_FILES, DOT_DOC_FILES, EXTRA_DOT_DOC_FILES):
Depend on $(BUILT_INCLUDES), in place of scmconfig.h which is included
in $(BUILT_INCLUDES).
2017-03-01 19:31:42 +01:00
Ludovic Courtès
7a32add5dc texinfo: Remove unnecessary (oop goops) dependency.
* module/texinfo/string-utils.scm: Remove #:use-module (oop goops).
2017-03-01 19:28:04 +01:00
Mark H Weaver
1d257c27f0 Do not assume that sizeof (long) == sizeof (void *) == sizeof (SCM).
This assumption does not hold on systems that use the LLP64 data model.

Partially fixes <https://debbugs.gnu.org/22406>.
Reported by Peter TB Brett <peter@peter-b.co.uk>.

* libguile/numbers.h (scm_t_inum): Move here from numbers.c, and change
  to be equivalent to 'long' (formerly 'scm_t_signed_bits').
  (SCM_MOST_POSITIVE_FIXNUM, SCM_MOST_NEGATIVE_FIXNUM): Define based on
  SCM_I_FIXNUM_BIT instead of SCM_T_SIGNED_BITS_MAX.
  (SCM_I_INUM): Adjust definitions to return a 'scm_t_inum', and avoiding
  the assumption that SCM_UNPACK returns a 'long'.
* libguile/numbers.c (scm_t_inum): Move definition to numbers.h.
  Verify that 'scm_t_inum' fits within a SCM value.
  (scm_i_inum2big): Remove preprocessor code that forced a compile error
  unless sizeof (long) == sizeof (void *).
2017-03-01 19:08:42 +01:00
Mark H Weaver
a8d1c7d610 Avoid signed integer overflows in numeric conversions.
Reported by Miroslav Lichvar <mlichvar@redhat.com>
in <https://lists.gnu.org/archive/html/guile-devel/2016-02/msg00045.html>

* libguile/conv-integer.i.c: Avoid signed overflow.
* libguile/numbers.c (scm_is_signed_integer): Avoid signed overflow.
2017-03-01 19:05:30 +01:00
Andy Wingo
36321a8ffd Remove extraneous debugging output in test
* test-suite/standalone/test-scm-c-bind-keyword-arguments.c
  (missing_value_error_handler): Remove debugging write.
2017-03-01 18:59:46 +01:00
Andy Wingo
82ea7c763b Fix open-file mode misinterpretation
* libguile/fports.c (scm_i_mode_to_open_flags): Validate that argument
  is string.  Fixes #25498.
2017-03-01 17:34:41 +01:00
Andy Wingo
24eea1be08 "select" no longer throws exception on EINTR
* doc/ref/posix.texi (Ports and File Descriptors): Update.
* libguile/filesys.c (scm_select): Use scm_std_select so that pending
  interrupts can be delivered.  On EINTR or EAGAIN, just return directly
  so that calling Scheme code can run asyncs.
2017-03-01 17:27:56 +01:00
Andy Wingo
0660364998 scm_std_select doesn't tick itself
* libguile/threads.c (scm_std_select): If there are unblocked asyncs
  pending, return directly instead of ticking ourselves.
2017-03-01 17:23:48 +01:00
Andy Wingo
0cd60c3f26 Cosmetic REPL server improvements
* module/system/repl/server.scm (run-server*): Cosmetic improvements.
2017-03-01 17:23:29 +01:00
Andy Wingo
374b88580c Fix trap frame matching
* module/system/vm/traps.scm (program-last-ip): Actually return an
  absolute IP.  Fixes traps!
2017-03-01 16:06:53 +01:00
Andy Wingo
77cfd7e4bf Fix class slot allocation since GOOPS rewrite
* module/oop/goops.scm (%compute-layout): Fix class slot layout.
  Before, a #:class that was an argument to #:allocation was getting
  interpreted as a keyword with a value.
* test-suite/tests/goops.test ("#:class slot allocation"): Add test.
2017-03-01 15:37:05 +01:00
Andy Wingo
a86bb2e613 Fix (mkstemp! "XX" 0) errors
* libguile/filesys.c (scm_i_mkstemp): Validate "mode" argument as a
  string, and validate writability of template string early too.  Thanks
  to Jean Louis for the bug report.
2017-03-01 14:48:37 +01:00
Andy Wingo
e13cd5c77c Flush when getting string from r6rs string output port
* module/rnrs/io/ports.scm (open-string-output-port): Calling the
  get-string proc should flush the buffer and reset the file position.
* test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Add tests.
  Thanks to Freja Nordsiek for the report.
2017-03-01 14:26:11 +01:00
Andy Wingo
1da66a6ab1 String ports can be truncated
* libguile/strports.c (string_port_truncate):
  (scm_make_string_port_type): Support truncate-file on string ports.
* test-suite/tests/ports.test ("string ports"): Add tests.
2017-03-01 14:24:36 +01:00
Andy Wingo
fcebf93ecb Minor expansion of guile-test comments
* test-suite/guile-test: Add -L to example.
2017-03-01 10:40:52 +01:00
Wilfred Hughes
67b8b6fb06 Favor docstrings for describing the purpose of functions.
* module/ice-9/boot-9.scm: Where functions have docstring-style
  comments, make them proper docstrings.
2017-03-01 10:09:38 +01:00
Andy Wingo
62f08b8f38 Fix "Scheme Syntax" info rendering
* doc/ref/api-evaluation.texi (Expression Syntax): Fix quote and
  quasiquote so that they actually look different in Info.
2017-03-01 09:41:57 +01:00
Andy Wingo
68f13adaaf Better errors for odd-length keyword args
* libguile/vm-engine.c (bind-kwargs):
* libguile/vm.c (vm_error_kwargs_missing_value):
* libguile/eval.c (error_missing_value)
  (prepare_boot_closure_env_for_apply): Adapt to mirror VM behavior.
* libguile/keywords.c (scm_c_bind_keyword_arguments): Likewise.
* module/ice-9/eval.scm (primitive-eval): Update to error on (foo #:kw)
  with a "Keyword argument has no value" instead of the horrible "odd
  argument list length".  Also adapts to the expected args format for
  the keyword-argument-error exception printer in all cases.  Matches
  1.8 optargs behavior also.
* test-suite/standalone/test-scm-c-bind-keyword-arguments.c (test_missing_value):
  (missing_value_error_handler): Update test.
* test-suite/tests/optargs.test: Add tests.
2017-02-28 22:01:20 +01:00
Andy Wingo
33514ffe22 Fix segfault introduced with R6RS port commit
* libguile/init.c (scm_i_init_guile): Move scm_register_r6rs_ports
  later, so that defining port types hsa the SCM trampoline subrs
  defined.
* libguile/bytevectors.c (scm_bootstrap_bytevectors): Cosmetic changes.
2017-02-28 17:02:25 +01:00
Andy Wingo
f3a1872703 "Scripting Examples" update.
* doc/ref/scheme-scripts.texi (Scripting Examples): Mention system* and
  open-pipe.
2017-02-28 16:22:42 +01:00
Andy Wingo
94d70684c1 Register R6RS port and bytevector internals early
* libguile/bytevectors.c (sym_big, sym_little): Rename from scm_sym_big
  and scm_sym_little, and don't use the snarf mechanism as we need to
  initialize this value eagerly in case the C API is used before the
  Scheme module is loaded.
  (scm_bootstrap_bytevectors): Initialize the endianness symbols here.
* libguile/r6rs-ports.c (scm_register_r6rs_ports): Register the R6RS
  port kinds here, for the same reason.
2017-02-28 14:19:24 +01:00
Andy Wingo
4c3bea3dba Fix support for threads already known to GC
* libguile/threads.h (scm_i_thread): Add bool tracking whether the
  thread needs to be unregistered from libgc.
* libguile/threads.c (guilify_self_1): Add needs_unregister arg.
  (on_thread_exit): Only unregister thread if the thread needs it.
  (scm_i_init_thread_for_guile): A thread needs unregistering if
  GC_register_my_thread succeeded.
  (scm_threads_prehistory): Don't unregister initial thread.

  Fixes #19523.  Thanks to Anthonin Bonnefoy for the report.
2017-02-28 13:14:02 +01:00
Andy Wingo
631e9901d8 Declare module exports before loading imports
* module/ice-9/boot-9.scm (define-module*): Process module imports after
  module exports.  Allows for an additional kind of circular module
  imports (see https://bugs.gnu.org/15540).
* test-suite/tests/modules.test ("circular imports"): Add test.
2017-02-28 11:49:15 +01:00
Andy Wingo
9e28a12121 Revert "futures: Limit the number of nested futures on the same stack."
This reverts commit 8a177d316c, though
keeping the additional tests.  (Guile 2.2 doesn't have a fixed stack
limit).
2017-02-28 10:45:21 +01:00
Andy Wingo
70d4c4b284 Fix (* x -1) for GOOPS types
* libguile/numbers.c (scm_product): Only reduce (* x -1) to (- x) when X
  is a bignum.  Fixes weirdness when X is not a number and instead
  multiplication should dispatch to GOOPS.  Thanks to Alejandro Sanchez
  for the report.
2017-02-28 10:12:57 +01:00
Diogo F. S. Ramos
f8dd4f67b5 Explain why no native accessors for s8' and u8' exist
* doc/ref/api-data.texi: Instead of saying it is obvious, explain why
  no native endianness accessors exist for the `s8' and `u8' variants.
2017-02-27 21:32:59 +01:00
Andy Wingo
f261eaf03a Fix guild compile --to=cps / --from=cps
* module/language/cps/spec.scm (read-cps, write-cps): Fix CPS
  serialization and parsing, so that "guild compile" works with --to=cps
  and --from=cps.
2017-02-23 11:37:44 +01:00
Andy Wingo
23278d07de Fix kfun parse-cps bug
* module/language/cps.scm (parse-cps): Fix bug parsing kfun.
2017-02-23 11:37:06 +01:00
Freja Nordsiek
b6d3ab6c0f Fixed specific version of guile search in autoconf macro GUILE_PROGS.
* meta/guile.m4 (GUILE_PROGS): Search for guile with suffixes
  first ('-X.Y' and 'X.Y' where X.Y denotes the version) before
  searching for guile with no suffix.  Patch co-authored by Andy Wingo.
2017-02-23 10:38:44 +01:00
Andy Wingo
7242ca566f Fix typo in old NEWS.
* NEWS: Fix typo.
2017-02-23 09:29:31 +01:00
Andy Wingo
c7fb87cd6e Fix multi-arity dispatch in GOOPS
* module/oop/goops.scm (multiple-arity-dispatcher): Fix dispatch for
  max-arity+1 when a generic is already in multiple-arity dispatch.
  Fixes #24454.
* test-suite/tests/goops.test ("dispatch"): Add test.
2017-02-22 23:10:46 +01:00
Andy Wingo
4dcc97288d Fix compute-frame-sizes for case-lambda jumps
* module/system/vm/frame.scm (compute-frame-sizes): Fix for jumps to the
  next arity.
2017-02-22 22:22:27 +01:00
Andy Wingo
5333642b71 Use labs instead of abs where needed
* libguile/numbers.c (log_of_fraction): Use labs instead of abs on
  longs.  Thanks to Matt Wette for the tip.
2017-02-21 22:12:18 +01:00
Matt Wette
c4b0491e91 Fix make-polar signedness of zeros on macOS
* configure.ac: Check for __sincos.
* libguile/numbers.c (scm_c_make_polar): Fall back to __sincos if
  possible.  Fixes zero signedness of make-polar on macOS.
2017-02-21 22:09:01 +01:00
Andy Wingo
36023a0d2e Conditionally define SOCK_CLOEXEC, SOCK_NONBLOCK
* libguile/socket.c (scm_init_socket): Conditionally define SOCK_CLOEXEC
  and SOCK_NONBLOCK.  Fixes compilation on macOS.
2017-02-21 22:01:45 +01:00
Andy Wingo
d0811644f6 Fix flonum/complex type inference.
* module/language/cps/types.scm (define-binary-result!): Arithmetic
  where one argument is a flonum may produce a complex.
* test-suite/tests/compiler.test: Add test.
2017-02-19 12:11:07 +01:00
Andy Wingo
c58c143f31 Guile 2.1.7.
* GUILE-VERSION: Bump to 2.1.7.
2017-02-18 10:17:17 +01:00
Andy Wingo
c288d396fc Update NEWS for 2.1.7.
* NEWS: Update.
2017-02-18 09:53:26 +01:00
Andy Wingo
db502f118e Fold 2.1.6 NEWS changes
* NEWS: Fold 2.1.6 changes into main 2.2 NEWS.
2017-02-18 09:21:04 +01:00
Andy Wingo
bfa6c401ce Speed up number->string
* libguile/numbers.c (scm_number_to_string): Use scm_from_latin1_string
  where appropriate.  Avoids mucking about with iconv.
2017-02-17 11:58:22 +01:00
Andy Wingo
9ee21f3e97 Minor make-string optimization
* libguile/strings.c (STRINGBUF_SET_MUTABLE): New helper.
  (scm_i_string_ensure_mutable_x): Use new helper.
  (scm_make_string): Mark stringbuf as mutable.
2017-02-17 11:29:31 +01:00
Andy Wingo
2864f11d34 Bump fluid cache size to 16 entries
* libguile/cache-internal.h (SCM_CACHE_SIZE): Bump to 16.  It seems that
  a thread accesses more than 8 fluids by default (%stacks, the
  exception handler, current ports, current-fiber, port read/write
  waiters) which leads every fiber to cause cache eviction and copying
  the value table, which is a bottleneck.  Instead just bump this cache
  size.
  (scm_cache_lookup): Update unrolled search.
2017-02-17 11:04:16 +01:00
Andy Wingo
60035b66c7 Revert "Cheaper fluid-ref cache"
This reverts commit cd3ff33a31.
2017-02-17 11:04:16 +01:00
Andy Wingo
d0934df1f2 Stringbufs immutable by default
* libguile/snarf.h (SCM_IMMUTABLE_STRINGBUF): Remove shared flag.
  Stringbufs are immutable by default.
* libguile/strings.c: Rewrite blurb.  Change to have stringbufs be
  immutable by default and mutable only when marked as such.  Going
  mutable means making a private copy.
  (STRINGBUF_MUTABLE, STRINGBUF_F_MUTABLE): New definitions.
  (SET_STRINGBUF_SHARED): Remove.
  (scm_i_print_stringbuf): Simplify to just alias the stringbuf as-is.
  (substring_with_immutable_stringbuf): New helper.
  (scm_i_substring, scm_i_substring_read_only, scm_i_substring_copy):
  use new helper.
  (scm_i_string_ensure_mutable_x): New helper.
  (scm_i_substring_shared): Use scm_i_string_ensure_mutable_x.
  (stringbuf_write_mutex): Remove; yaaaaaaaay.
  (scm_i_string_start_writing): Use scm_i_string_ensure_mutable_x.  No
  more mutex.
  (scm_i_string_stop_writing): Now a no-op.
  (scm_i_make_symbol): Use substring/copy.
  (scm_sys_string_dump, scm_sys_symbol_dump): Update.
* libguile/strings.h (SCM_I_STRINGBUF_F_SHARED): Remove.
  (SCM_I_STRINGBUF_F_MUTABLE): Add.
* module/system/vm/assembler.scm (link-data): Don't add shared flag any
  more.  Existing compiled flags are harmless tho.
* test-suite/tests/strings.test ("string internals"): Update.
2017-02-16 13:11:29 +01:00
Andy Wingo
c38b9625c8 Remove unnecessary scm_i_string_start_writing calls
* libguile/strings.c (scm_string, scm_c_make_string):
* libguile/srfi-13.c (scm_reverse_list_to_string, scm_string_map)
  (scm_string_unfold, scm_string_unfold_right, scm_xsubstring)
  (scm_string_filter, scm_string_delete): Remove
  scm_i_string_start_writing / scm_i_string_stop_writing calls around
  fresh strings that aren't visible to other threads.
2017-02-16 10:43:23 +01:00