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

17263 commits

Author SHA1 Message Date
Chris Jester-Young
cffa9bd6a3 Implement SRFI 28: Basic Format Strings.
* module/srfi/srfi-28.scm: New module.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-28.scm.
* doc/ref/srfi-modules.texi (SRFI-28): New node.
2014-12-02 11:49:05 -05:00
Ludovic Courtès
d1447c717b doc: Clarify behavior of 'select' in the presence of signal interruptions.
Fixes <http://bugs.gnu.org/18988>.
Reported by Chris Vine <chris@cvine.freeserve.co.uk>.

* libguile/filesys.c (scm_select): Clarify handling of signal
  interruptions.
* doc/ref/posix.texi (Ports and File Descriptors): Adjust accordingly.
2014-11-20 21:32:44 +01:00
Rob Browning
136c3a4c4a Recognize m68k, s390x, and sh4 as compilation targets
* module/system/base/target.scm (cpu-endianness, triplet-pointer-size):
  Add cases for "m68k", "sh4", and "s390x".

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-11-19 14:07:10 +01:00
Mark H Weaver
ae6f77ddfa Fix bytevector-fill! to accept fill arguments greater than 127.
Fixes <http://bugs.gnu.org/19027>.

* libguile/bytevectors.c (scm_bytevector_fill_x): Accept fill arguments
  between -128 and 255.

* test-suite/tests/bytevectors.test ("2.2 General Operations"): Add
  tests.
2014-11-12 00:50:38 -05:00
Mark H Weaver
81d2c84674 Avoid signed overflow and use size_t in bytevectors.c.
* libguile/bytevectors.c (ULONG_MAX): Remove (unportable) fallback
  definition.  It is no longer used.
  (scm_make_bytevector): Use 'size_t' instead of 'unsigned' for
  indices.  Use 'scm_t_uint8' instead of 'signed char' for elements
  and c_fill.  Previously relied on GNU-C-specific behavior when
  casting integers in the range 128-255 to signed char.
  (GENERIC_INTEGER_ACCESSOR_PROLOGUE, INTEGER_LIST_TO_BYTEVECTOR)
  (scm_bytevector_eq_p, scm_bytevector_copy_x, scm_bytevector_copy)
  (scm_bytevector_to_u8_list, scm_u8_list_to_bytevector)
  (scm_bytevector_fill_x): Use 'size_t' instead of 'unsigned' for
  indices.  Use 'scm_t_uint8' for elements.
2014-11-12 00:37:00 -05:00
Mark H Weaver
fdd319e9bd Add SCM_VALIDATE_SIZE_COPY and SCM_NUM2SIZE.
* libguile/validate.h (SCM_VALIDATE_SIZE_COPY, SCM_NUM2SIZE): New
  macros.
2014-11-12 00:19:10 -05:00
Mark H Weaver
10679f4c59 Fix bytevector-copy when applied to SRFI-4 homogeneous numeric vectors.
Fixes <http://bugs.gnu.org/18866>.
Reported by tantalum <sph@posteo.eu>.

* libguile/bytevectors.c (scm_bytevector_copy): Always create a VU8
  bytevector.

* test-suite/tests/bytevectors.test: Add test.
2014-11-11 23:32:57 -05:00
Thomas Klausner
03242f398f Avoid bash-specific '==' comparison operator in guile.m4.
Fixes <http://bugs.gnu.org/18898>.

* meta/guile.m4 (GUILE_PROGS): Use '=' instead of the bash-specific '=='
  comparison operator in 'test' call.
2014-11-11 22:43:51 -05:00
Mark H Weaver
fda17c20a3 Fix strerror error handling when given a non-integer argument.
Fixes <http://bugs.gnu.org/18065>.
Reported and fixed by Glenn Michaels <gmichaels@Safe-mail.net>.

* libguile/error.c (scm_strerror): Convert the argument to a C integer
  outside of the critical section, to avoid deadlock on error.
* THANKS: Add Glenn Michaels to the fixes section.
2014-11-11 22:36:30 -05:00
Andy Wingo
3f826e3c9e texinfo: fix @url{@@} parsing
* module/texinfo.scm (texi-command-specs): The body of @url{} can have
  texinfo commands.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add tests.
2014-11-09 15:56:33 +00:00
Andy Wingo
18c44b29e4 web: Location header is URI-reference; better URI-reference support
* module/web/uri.scm (validate-uri): Add reference? keyword argument,
  for validating references.
  (build-uri): Clarify comments to indicate that the result is an
  absolute URI.
  (build-uri-reference): New interface, to build URI-references.
  (string->uri-reference): Rename from string->uri*.  Fix fragment
  parsing to not include the #.
  (string->uri): Adapt to string->uri-reference name change.

* module/web/request.scm (request-absolute-uri): Add default-scheme
  optional argument.  Use it if the request-uri has no scheme, or
  error.

* module/web/http.scm (write-uri): Reflow to use "when".  Fix writing of
  URI-reference instances.
  (declare-uri-reference-header!): Rename from
  declare-relative-uri-header!.  Use string->uri-reference.
  ("Location"): Declare as a URI-reference header, as per RFC 7231.

* module/web/client.scm (open-socket-for-uri): Handle the case in which
  there is no URI scheme.

* test-suite/tests/web-http.test:
* test-suite/tests/web-uri.test: Add tests.
2014-11-01 15:36:56 +01:00
Ludovic Courtès
a7bbba0583 Use on-stack or GC-managed memory in 'search-path'.
* libguile/load.c (stringbuf_free): Remove.
  (stringbuf_grow): Use 'scm_gc_malloc_pointerless' instead of 'scm_realloc'.
  (search_path): Use stack-allocated INITIAL_BUFFER instead of
  'scm_malloc'.  Remove use of 'stringbuf_free'.
2014-11-01 00:48:11 +01:00
Ludovic Courtès
9c5d6aa964 Reduce C heap allocations in 'search-path'.
* libguile/load.c (scm_c_string_has_an_ext): Rename to...
  (string_has_an_ext): ... this.  Add docstring.  Change
  'str' to be an SCM, and remove 'len' parameter.  Change loop body to
  use 'scm_string_suffix_p'.
  (search_path): Update accordingly.
2014-11-01 00:48:11 +01:00
Daniel Llorens
7f2c824551 Merge branch 'lloda-array-support' 2014-10-30 11:42:05 +01:00
Mark H Weaver
30c5982a95 i18n: Add HAVE_USELOCALE as a requirement for USE_GNU_LOCALE_API.
* configure.ac: Check for uselocale.
* libguile/i18n.c: Add HAVE_USELOCALE to the list of requirements
  before defining USE_GNU_LOCALE_API.
2014-10-14 20:36:19 -04:00
Mark H Weaver
b9ace68613 scm_boot_guile: Gracefully handle the case where argc == 0.
Fixes <http://bugs.gnu.org/18680>.
Reported by Nala Ginrut <nalaginrut@gmail.com>.

* libguile/init.c (scm_boot_guile): Do not canonicalize argv[0] unless
  argc > 0.
* THANKS: Add Nala Ginrut to the fixes section.
2014-10-10 23:31:55 -04:00
Mark H Weaver
6b47249a28 Thank Per Bothner.
* THANKS: Add Per Bothner to the "libraries" section (for SRFI-64).
2014-10-07 00:01:45 -04:00
Ludovic Courtès
449be2a5e5 build: Adjust autogen.sh to 'libtoolize' name on Darwin.
Reported by Daniel Llorens.

* autogen.sh: Use 'glibtoolize' on Darwin.
2014-10-06 15:23:10 +02:00
Mark H Weaver
5af307de43 read: Accept "\(" in string literals.
Suggested by David Kastrup <dak@gnu.org> in <http://bugs.gnu.org/13644>.

* libguile/read.c (scm_read_string_like_syntax): Accept "\(" as
  equivalent to "(".
* doc/ref/api-data.texi (String Syntax): Document it.
* test-suite/tests/reader.test ("reading"): Add test.
2014-10-01 21:00:23 -04:00
Mark H Weaver
b1451ad859 docs: Fix documented return type of 'scm_c_export'.
Fixes <http://bugs.gnu.org/17869>.
Reported and fixed by Alexei Matveev <alexei.matveev@gmail.com>.

* doc/ref/api-modules.texi (Accessing Modules from C): Change documented
  return type of 'scm_c_export' to 'void' to reflect reality.
* THANKS: Add Alexei Matveev to the fixes section.
2014-10-01 19:13:34 -04:00
Daniel Llorens
0f259045e1 Intern general arrays
* module/system/vm/assembler.scm (intern-constant, link-data): handle
  the array case.
2014-09-30 11:35:08 +02:00
Daniel Llorens
65704b982d Pack array dimensions in array object
* libguile/arrays.c (scm_i_make_array): redo object layout.

* libguile/arrays.h (SCM_I_ARRAY_V, SCM_ARRAY_BASE, SCM_I_ARRAY_DIMS):
  to match new layout.

  (SCM_I_ARRAY_SET_V, SCM_ARRAY_SET_BASE): new setters.

  (SCM_I_ARRAY_MEM, scm_i_t_array): unused, remove.

  (scm_i_shap2ra, scm_make_typed_array, scm_from_contiguous_typed_array,
  scm_from_contiguous_array, scm_make_shared_array, scm_transpose_array,
  scm_array_contents): fix uses of SCM_I_ARRAY_V, SCM_ARRAY_BASE as
  lvalues.

* libguile/array-map.c (make1array, scm_ramapc): fix uses of
  SCM_I_ARRAY_V, SCM_ARRAY_BASE as lvalues.
2014-09-30 11:35:08 +02:00
Daniel Llorens
ea342aa6f7 Run some of arrays.test under both compiler & interpreter
* test-suite/test-suite/lib.scm (c&e): accept (pass-if exp) clause.

* test-suite/tests/arrays.test: use with-prefix/c&e instead of
  with-prefix where possible.
2014-09-30 11:35:08 +02:00
Mark H Weaver
856d318a9f Merge branch 'stable-2.0'
Conflicts:
	benchmark-suite/benchmarks/ports.bm
	libguile/async.h
	libguile/bytevectors.c
	libguile/foreign.c
	libguile/gsubr.c
	libguile/srfi-1.c
	libguile/vm-engine.h
	libguile/vm-i-scheme.c
	module/Makefile.am
	module/language/tree-il/analyze.scm
	module/language/tree-il/peval.scm
	module/scripts/compile.scm
	module/scripts/disassemble.scm
	test-suite/tests/asm-to-bytecode.test
	test-suite/tests/peval.test
	test-suite/tests/rdelim.test
2014-09-30 03:50:47 -04:00
Andy Wingo
3157d45503 Add (ice-9 unicode) module
* libguile/unicode.c:
* libguile/unicode.h:
* test-suite/tests/unicode.test:
* module/ice-9/unicode.scm: New files.

* module/Makefile.am:
* libguile/Makefile.am:
* test-suite/Makefile.am:
* libguile/init.c: Wire new files into the build.

* doc/ref/api-data.texi: Add docs.
2014-09-29 21:54:14 -04:00
Mark H Weaver
7a71a45cfd peval: Handle optional argument inits that refer to previous arguments.
Fixes <http://bugs.gnu.org/17634>.
Reported by Josep Portella Florit <jpf@primfilat.com>.

* module/language/tree-il/peval.scm (inlined-application): When inlining
  an application whose operator is a lambda expression with optional
  arguments that rely on default initializers, expand into a series of
  nested let expressions, to ensure that previous arguments are in scope
  when the default initializers are evaluated.

* test-suite/tests/peval.test ("partial evaluation"): Add tests.
2014-09-28 23:51:20 -04:00
Mark H Weaver
ff4af3df23 doc: Improve description of vector-unfold and vector-unfold-right.
* doc/ref/srfi-modules.texi (SRFI-43 Constructors)[vector-unfold]:
  Improve description.
* module/srfi/srfi-43.scm (vector-unfold, vector-unfold-right):
  Improve docstrings.
2014-09-24 22:03:58 -04:00
David Kastrup
f7582f9807 Fix ungetc for characters 0x80 <= c < 0xf0 in UTF-8.
Fixes <http://bugs.gnu.org/18536>.

* libguile/ports.c (scm_ungetc_unlocked): Fix bad UTF-8 reencoding,
  introduced in commit be7ecef05c.

Signed-off-by: David Kastrup <dak@gnu.org>
2014-09-23 21:41:20 -04:00
Ludovic Courtès
447af515a3 Add 'EXIT_SUCCESS' and 'EXIT_FAILURE'.
Suggested by Frank Terbeck <ft@bewatermyfriend.org>.

* libguile/posix.c (scm_init_posix): Define 'EXIT_SUCCESS' and
  'EXIT_FAILURE'.
* doc/ref/posix.texi (Processes): Document them.
2014-09-22 22:51:39 +02:00
David Michael
3a3316e200 guile-readline: Use the current directory if HOME is unset.
* guile-readline/ice-9/readline.scm (history-file): When the HOME
  environment variable is unset, use the current directory instead.
2014-09-21 23:21:29 -04:00
Ludovic Courtès
76a8db27c6 build: Use 'libtoolize' in autogen.sh.
Fixes <http://bugs.gnu.org/18470>.
Reported by Rob Browning <rlb@defaultvalue.org>.

* autogen.sh: Invoke 'libtoolize' instead of 'libtool'.
2014-09-20 14:36:35 +02:00
David Kastrup
8442211ef0 Fix SCM_SMOB_OBJECT{_,_0_,_1_,_2_,_3_}LOC.
Fixes <http://bugs.gnu.org/18495>.

* libguile/smob.h (SCM_SMOB_OBJECT_LOC, SCM_SMOB_OBJECT_0_LOC)
  (SCM_SMOB_OBJECT_1_LOC, SCM_SMOB_OBJECT_2_LOC)
  (SCM_SMOB_OBJECT_3_LOC): These elementary API macros have been broken
  by commit 56164dc47f in 2009.

Signed-off-by: David Kastrup <dak@gnu.org>
2014-09-20 06:36:42 -04:00
Mark H Weaver
f2742bdd68 guild disassemble: Use #:prefix instead of #:renamer.
* module/scripts/disassemble.scm: Use #:prefix instead of #:renamer
  in #:use-module clause.
2014-09-20 05:47:05 -04:00
Mark H Weaver
0fce815b1b Document #:prefix option in use-module clauses.
* doc/ref/api-modules.texi (Using Guile Modules): Document #:prefix
  option.
2014-09-20 05:46:45 -04:00
Mark H Weaver
8f230e3341 SRFI-43: vector-concatenate: Fix error message.
* module/srfi/srfi-43.scm (vector-concatenate): Fix the 'who' of an
  error message.
2014-09-20 05:44:15 -04:00
Mark H Weaver
97c520fd3f VM: Use register "a3" for IP_REG on m68k.
Subset of a patch by Andreas Schwab <schwab@linux-m68k.org>.
Reported by Rob Browning <rlb@defaultvalue.org>.

* libguile/vm-engine.h (IP_REG)[__mc68000__]: Use register "a3".
2014-09-20 05:43:27 -04:00
Mark H Weaver
bed025bd25 VM: Allow the C compiler to choose FP_REG on ARM.
Reported by Rob Browning <rlb@defaultvalue.org>.

* libguile/vm-engine.h (IP_REG)[__arm__]: Remove explicit register
  choice ("r7") for FP_REG, which was reported to cause compilation
  failures on ARM.
2014-09-20 05:40:24 -04:00
Mark H Weaver
156119b022 Do not assume that 64-bit integers will be 64-bit aligned.
* libguile/foreign.c (raw_bytecode, objcode_cells):
* libguile/gsubr.c (raw_bytecode, objcode_cells): Use SCM_ALIGNED to
  ensure 64-bit alignment.
2014-09-20 05:38:05 -04:00
Mark H Weaver
a85c78ea13 VM: ASM_MUL for ARM: Add earlyclobber constraint to the SMULL outputs.
Reported by Rob Browning <rlb@defaultvalue.org>.

* libguile/vm-i-scheme.c (ASM_MUL)[ARM]: Add earlyclobber (&) constraint
  to the SMULL output registers.
2014-09-20 05:30:41 -04:00
Ludovic Courtès
b38c19a5a5 tests: Link test against Gnulib.
Reported by Eli Zaretskii <eliz@gnu.org>.

* test-suite/standalone/Makefile.am (test_scm_take_locale_symbol_LDADD):
  Add libgnu.la, for the 'strdup' replacement.
2014-09-17 13:43:55 +02:00
Andy Wingo
c5ea75534c Add (ice-9 unicode) module
* libguile/unicode.c:
* libguile/unicode.h:
* test-suite/tests/unicode.test:
* module/ice-9/unicode.scm: New files.

* module/Makefile.am:
* libguile/Makefile.am:
* test-suite/Makefile.am:
* libguile/init.c: Wire new files into the build.

* doc/ref/api-data.texi: Add docs.
2014-09-12 17:00:59 +02:00
Ludovic Courtès
9233c05585 Thank Franck. 2014-08-26 23:41:33 +02:00
Ludovic Courtès
8ac39b38d1 Handle ~p in 'format' warnings.
Fixes <http://bugs.gnu.org/18299>.
Reported by Frank Terbeck <ft@bewatermyfriend.org>.

* module/language/tree-il/analyze.scm (format-string-argument-count):
  Add case for ~p.
* test-suite/tests/tree-il.test ("warnings")["format"]("~p", "~p, too
  few arguments", "~:p", "~:@p, too many arguments", "~:@p, too few
  arguments"): New tests.
2014-08-26 23:41:33 +02:00
Andy Wingo
7f5887e70b Separate &boolean type into &true and &false
* module/language/cps/types.scm (&all-types): Represent true and false
  as separate bits, so that #f can be removed from types on true
  branches.  Adapt all users.

* module/language/cps/type-fold.scm (&scalar-types):
  (fold-and-reduce): Adapt to boolean type representation change.
2014-08-24 17:07:49 +02:00
Eli Zaretskii
c6a7930b38 On MS-Windows, don't return file names with backslashes from search-path.
* libguile/load.c (search_path): On MS-Windows, convert all
  backslashes to forward slashes if the file was found on PATH.
2014-08-15 09:47:52 +03:00
Mark H Weaver
cfefef6bd9 Copy the result from 'nl_langinfo' before it can be overwritten.
Based on a patch by Eli Zaretskii <eliz@gnu.org>.

* libguile/i18n.c (copy_string_or_null): New static function.
  (scm_nl_langinfo): Use 'copy_string_or_null' to copy the result from
  'nl_langinfo' and 'nl_langinfo_l' before the next call and before
  releasing the locale mutex.
2014-08-13 22:47:32 -04:00
Eli Zaretskii
7c848fe572 Make temporary file in coding.test work on MS-Windows.
* test-suite/tests/coding.test (with-temp-file): Instead of
  hard-coding "/tmp" as the temporary directory, use $TMPDIR or
  $TEMP from the environment, and fall back on "/tmp" if none of
  those 2 is defined.
2014-08-13 18:41:15 +03:00
Ludovic Courtès
1e9249e0cd doc: "!#" does not need to appear on a line of its own.
* doc/ref/api-evaluation.texi (Block Comments): Remove "which must appear on a
  line of their own".  Reported by David Michael <fedora.dm0@gmail.com>.
2014-08-12 22:23:22 +02:00
David Kastrup
da6ecd4923 Clarify that object-properties cannot be reliably applied to numbers.
* doc/ref/api-utility.texi (Object Properties)[make-object-property]:
  Clarify that object-properties cannot be reliably applied to numbers.

Signed-off-by: David Kastrup <dak@gnu.org>
2014-08-10 22:55:25 -04:00
Ian Price
b072b8e692 Provide curried version of define*-public.
* module/ice-9/curried-definitions.scm (define*-public): New macro.
2014-07-31 16:05:58 +01:00