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

15499 commits

Author SHA1 Message Date
Andy Wingo
62134ca5e9 squirrely smob marking refactor
* libguile/smob.c (smob_mark): No idea what the right thing is to do
  here.
2013-01-15 19:13:09 +01:00
Andy Wingo
2fe300ae8d remove scm_is_pair gcc hack
* libguile/pairs.h (scm_is_pair): Remove the (crufty!) GCC workaround,
  as we no longer check the heap to see if something is a pair.
2013-01-15 19:13:09 +01:00
Andy Wingo
b071ce2147 redo the SCM tagging strategy
Currently failing some guardian tests.

* libguile/tags.h: Refactor tagging so that tc3 bits for a pair live in
  the SCM value, not in the heap words.  Do the same for structs.  This
  more rational tagging strategy will make native code generation
  easier.  Note that this means that to check a heap pointer for its
  type, you first have to ensure that it has the expected tc3, as not
  all the type bits are on the heap.
  (SCM_TYP3): Check the SCM tag type, not the bits in the cell.
  (SCM_HAS_TYP3): New helper.
  (SCM_I_CONSP): Redefine to just check the typ3.
  (scm_tcs_cons_imcar, scm_tcs_cons_nimcar, scm_tcs_struct): Remove, as
  they are no longer necessary.

* libguile/array-handle.c (scm_i_array_implementation_for_obj): Check
  for heap objects before checking type bits, so we don't check pairs.

* libguile/evalext.c (scm_self_evaluating_p):
* libguile/gc.c (scm_i_tag_name):
* libguile/goops.c (scm_class_of)
* libguile/hash.c (scm_hasher):
* libguile/print.c (iprin1): Adapt to tagging changes.

* libguile/gc.c (scm_storage_prehistory): Register all displacements
  here.  There are the same displacements as before, unfortunately.

* libguile/list.c (SCM_I_CONS):
* libguile/pairs.c (scm_cons):
* libguile/pairs.h (scm_is_pair):
* libguile/vm-engine.h (CONS): Tag pairs with scm_tc3_pair.

* libguile/modules.c (scm_post_boot_init_modules):
* libguile/modules.h (SCM_MODULEP):
* libguile/struct.c (struct_finalizer_trampoline, scm_i_alloc_struct):
  (scm_make_vtable_vtable):
* libguile/struct.h (SCM_STRUCTP, SCM_STRUCT_VTABLE_DATA):
  (SCM_STRUCT_VTABLE_SLOTS):
* libguile/vm-i-scheme.c (make-struct): Adapt to struct tagging
  changes.

* libguile/numbers.h (SCM_I_INUMP):
* module/rnrs/arithmetic/fixnums.scm (fixnum?, inline-fixnum?): Adapt
  to the new fixnum tag.

* libguile/numbers.h (SCM_INEXACTP): Make sure of the tc3 before looking
  at the cell type.
2013-01-15 19:13:03 +01:00
Andy Wingo
03daea184e add SCM_HEAP_OBJECT_BASE
* libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro.  Given a SCM,
  returns a pointer to the start of its memory area on the heap.

* libguile/bytevectors.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/gc.h:
* libguile/guardians.c:
* libguile/numbers.h:
* libguile/ports.c:
* libguile/smob.c:
* libguile/struct.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Use it.
2013-01-15 18:30:18 +01:00
Andy Wingo
449ca87bdb ASCII is not ISO-8859-1
* libguile/ports.c (scm_i_set_default_port_encoding): An encoding of
  ASCII is not the same as ISO-8859-1, because it does not allow
  characters above 128.  Fix this.
2013-01-15 16:37:01 +01:00
Andy Wingo
e5cef86e9c fix string->bytevector for utf-8 and non-error conversion strategies
* module/ice-9/iconv.scm (call-with-encoded-output-string):
  (string->bytevector, bytevector->string): Only call string->utf8 and
  utf8->string if the conversion strategy is `error'.
2013-01-15 16:37:01 +01:00
Andy Wingo
686df5162d string->utf8 implementation uses scm_from_utf8_stringn
* libguile/bytevectors.c (UTF_TO_STRING): Use scm_from_utf8_stringn.
2013-01-15 16:36:55 +01:00
Andy Wingo
b39685c6da scm_from_stringn and scm_to_stringn encoding args are never NULL
* libguile/strings.c (scm_from_stringn, scm_to_stringn): Encoding
  argument cannot be NULL.  Instead check that the encoding was
  ISO-8859-1.
2013-01-15 16:32:52 +01:00
Andy Wingo
d1b9f8ace9 Port encodings cannot be NULL
* libguile/ports.c (scm_c_read_unlocked, scm_ungetc_unlocked):
* libguile/read.c (scm_read_character):
* libguile/vports.c (sf_fill_input): Port encodings cannot be NULL any
  more, now that encodings are canonicalized, so simplify these.
2013-01-15 16:32:52 +01:00
Andy Wingo
e2551947dd All r6rs ports are both textual and binary
* module/rnrs/io/ports.scm (binary-port?): All ports are binary _and_
  textual.  Bytevectors and strings may be written to or read from
  either.
  (port-transcoder): All textual ports (all ports) have transcoders of
  some sort.

* test-suite/tests/r6rs-ports.test ("8.2.6  Input and output ports"):
  Remove test that binary ports don't have transcoders, because binary
  ports are also textual.
2013-01-15 16:32:52 +01:00
Andy Wingo
93c4fa2174 Port encodings are case-insensitive, but normalized to upper-case.
* libguile/ports.c (ascii_toupper, encoding_matches)
  (canonicalize_encoding): New helpers.

  (scm_c_make_port_with_encoding):
  (scm_i_set_default_port_encoding):
  (scm_i_set_port_encoding_x): Use the new helpers to be
  case-insensitive and also to canonicalize the internal representation
  to upper-case ASCII names.

  (scm_i_default_port_encoding): Never return NULL.
  (scm_port_encoding): The encoding is always a string.

* libguile/read.c (scm_i_scan_for_encoding): Use a locale-independent
  check instead of isalnum.  Don't upcase the result: the port code will
  handle that.

* test-suite/tests/web-response.test ("example-1"): Adapt test to expect
  normalized (upper-case) encoding for the response port.
2013-01-15 16:32:17 +01:00
Andy Wingo
08467a7e61 add scm_from_port_string and friends
* doc/ref/api-data.texi (Conversion to/from C):
* libguile/strings.h:
* libguile/strings.c (scm_from_port_string, scm_from_port_stringn):
  (scm_to_port_string, scm_to_port_stringn): New functions.

* guile-readline/readline.c (internal_readline):
* libguile/strports.c (scm_strport_to_string):
* libguile/read.c (scm_read_number, scm_read_mixed_case_symbol):
  (scm_read_number_and_radix, scm_read_character): Use the new
  functions.
2013-01-15 16:32:17 +01:00
Andy Wingo
99d716b6f6 UTF-8 string ports in ecmascript test
* test-suite/tests/ecmascript.test (eread, eread/1): Make sure we can
  render the temporary string ports by specifying UTF-8.
2013-01-15 16:32:17 +01:00
Andy Wingo
8c76a8971b fix bug where scm_from_utf8_stringn would not detect bad utf-8
* libguile/strings.c (scm_from_utf8_stringn):
* libguile/symbols.c (utf8_string_equals_wide_string): The "bad UTF8"
  return from u8_mbtouc is a 0xfffd character, not a negative byte
  length.  Fixes a bug in which invalid UTF-8 would not be caught.

* libguile/bytevectors.c (scm_utf8_to_string): Use scm_from_utf8_stringn
  directly.  Just a little cleanup.

* test-suite/tests/iconv.test ("narrow non-ascii string"): Add test for
  parsing bad utf-8 with substitution.
2013-01-15 11:01:10 +01:00
Andy Wingo
b4fa6cc909 Merge remote-tracking branch 'origin/stable-2.0'
There is a failing test due to a scm_from_utf8_stringn bug brought out
by the iconv test that will be fixed in the next commit.

Conflicts:
	libguile/deprecated.h
	module/ice-9/deprecated.scm
2013-01-15 10:45:39 +01:00
Andy Wingo
18c5bffe96 Docstrings in (ice-9 iconv)
* module/ice-9/iconv.scm: Add docstrings.
2013-01-11 21:28:51 +01:00
Andy Wingo
5ed4ea90a9 Change iconv procedures to take optional instead of keyword arg
* module/ice-9/iconv.scm (call-with-encoded-output-string):
  (string->bytevector, bytevector->string): Take an optional instead of
  a keyword argument.

* doc/ref/api-data.texi (Representing Strings as Bytes): Adapt docs to
  change, and fix a number of errors.  Thanks to Ludovic Courtès for the
  pointers.

* test-suite/tests/iconv.test ("wide non-ascii string"): Add a test for
  the 'substitute path.
2013-01-11 21:15:28 +01:00
Andy Wingo
990b11c53f Add http-post, http-put, et cetera
* module/web/client.scm (ensure-uri): New helper.
  (open-socket-for-uri): Accept a URI as a string or as a URI object.
  (extend-request, sanitize-request): New helpers, like the
  corresponding functions in (web server).
  (decode-response-body): Add a reference to the HTTP/1.1 spec, and
  use (ice-9 iconv).
  (request): New helper, factoring all aspects of sending an HTTP
  request and getting a response.
  (http-get): Redefine in terms of http-get.  Deprecate the
  #:extra-headers argument in favor of #:headers.  Allow a body.  Add a
  #:streaming? argument, subsuming the functionality of http-get*.
  (http-get*): Deprecate.
  (http-head, http-post, http-put, http-delete, http-trace)
  (http-options): Define interfaces for all HTTP verbs.

* test-suite/tests/web-client.test: Add tests.

* doc/ref/web.texi: Update documentation.

Thanks to Gregory Benison for the initial patch.
2013-01-11 15:40:00 +01:00
Andy Wingo
2ac3c0a590 read-response-body always returns bytevector or #f
* module/web/response.scm (read-response-body): Fix to always return
  either a bytevector or #f.  Previously, reading a 0-length body could
  return the EOF object.
2013-01-11 15:15:43 +01:00
Andy Wingo
67e5ab8ac6 remove (web http) TODO list
* module/web/http.scm: Remove outdated TODO list.
2013-01-11 15:15:42 +01:00
Andy Wingo
8cb9a30c17 (web server) uses (ice-9 iconv)
* module/web/server.scm (sanitize-response): Use the procedures
  from (ice-9 iconv) to encode the response.
2013-01-11 15:15:42 +01:00
Andy Wingo
f05bb8494c add bytevector->string and string->bytevector in new (ice-9 iconv) module
* module/Makefile.am:
* module/ice-9/iconv.scm: New module implementing procedures to encode
  and decode representations of strings as bytes.

* test-suite/Makefile.am:
* test-suite/tests/iconv.test: Add tests.

* doc/ref/api-data.texi: Add docs.
2013-01-11 15:15:37 +01:00
Andy Wingo
b194b59fa1 fix ice-9/slib
* module/ice-9/slib.scm: Change to just load up slib.init directly.  The
  recently submitted patch to slib-discuss and guile-user should make
  this work correctly.
2013-01-10 17:30:38 +01:00
Andy Wingo
921cd222b9 deprecate SCM_CHAR_CODE_LIMIT and char-code-limit
* libguile/__scm.h:
* libguile/deprecated.h (SCM_CHAR_CODE_LIMIT): Move declaration here
  from __scm.h.

* libguile/feature.c:
* module/ice-9/deprecated.scm (char-code-limit): Move definition here.

* test-suite/tests/regexp.test: Update to not use char-code-limit.
2013-01-10 16:01:06 +01:00
Andy Wingo
03a2f59851 slight open-pipe* / open-process refactor
* libguile/posix.c (scm_open_process): Return the ports as values
  instead of calling out to Scheme again to make-rw-port.  This
  function is private to (ice-9 popen).

* module/ice-9/popen.scm (open-pipe*): Adapt to change.
2013-01-08 12:58:05 +01:00
Mark H Weaver
e0c211bb2e Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
	libguile/posix.c
	module/ice-9/eval.scm
	test-suite/tests/cse.test
2013-01-07 17:23:26 -05:00
Andy Wingo
ed3e8b8e06 http-get: don't shutdown write end of socket
* module/web/http.scm ("Connection"): Write the "close" token in
  lower-case.

* module/web/client.scm (http-get): Don't shutdown the writing side of
  the pipe if we are not doing a keepalive, as this may prevent the
  request from being sent at all.  Prevented http://friendfeed.com/ from
  being correctly fetched.
2013-01-07 23:21:16 +01:00
Andy Wingo
4dbac5e08b Fix partial commit of documentation update
* doc/ref/api-procedures.texi (Compiled Procedures): Fix
  partially-committed doc update.
2013-01-07 23:19:10 +01:00
Andy Wingo
9f17d967c9 More procedure-arguments-alist documentation and a bugfix
* doc/ref/api-procedures.texi (Compiled Procedures): Expand
  program-arguments-alist and program-lambda-list documentation.

* module/system/vm/program.scm (arity->arguments-alist): Fix the rest
  arg if there are also keyword args, a bug found while documenting!

* test-suite/tests/session.test ("procedure-arguments"): Update.
2013-01-07 22:02:26 +01:00
Cedric Cellier
6fca8730f7 document program-arguments-alist and program-lambda-list 2013-01-07 20:37:07 +01:00
Andy Wingo
44390164ce minor cleanup in values.c
* libguile/values.c (scm_c_value_ref): Use scm_from_size_t to assimilate
  a size_t.
2013-01-07 20:36:41 +01:00
Ludovic Courtès
c23fb152b7 tests: Remove leftover `pk'.
* test-suite/tests/posix.test ("system*"): Remove `pk'.
2012-12-19 23:31:05 +01:00
Ludovic Courtès
668ba7c955 Change `system*' to not leave dangling processes behind.
Fixes <http://bugs.gnu.org/13166>.

* libguile/simpos.c (scm_system_star): In the child, call `_exit'
  instead of `SCM_SYSERROR' when `execvp' fails.
* test-suite/tests/posix.test ("system*"): New test prefix.
2012-12-19 23:15:45 +01:00
Ludovic Courtès
b9d724982d web: Correctly detect "No route to host" conditions.
* module/web/client.scm (open-socket-for-uri): Delete addrinfos
  with the same address.  Always open SOCK_STREAM/IPPROTO_IP sockets.
  Fix the error handler's condition to determine what to do.
  Reported by Nikita Karetnikov <nikita.karetnikov@gmail.com> at
  <http://lists.gnu.org/archive/html/bug-guix/2012-12/msg00150.html>.
2012-12-17 00:27:00 +01:00
Ludovic Courtès
21982d68ab build: Require Automake 1.11.2 or later.
* configure.ac: Require Automake 1.11.2 or later.
  Reported by Sjoerd van Leent Privé <svanleent@gmail.com>
  in <http://bugs.gnu.org/13117>.
2012-12-10 23:41:06 +01:00
Daniel Hartwig
afdf5467e5 repl: add repl-option for customized print
Closes <http://bugs.gnu.org/13077>.

* module/system/repl/common.scm (repl-default-options)
  (repl-print): Add option to use customized print procedure.
* doc/ref/scheme-using.texi (REPL Commands): Update.
2012-12-10 23:41:06 +01:00
Ludovic Courtès
9977b31643 test-suite: Skip EACCES' test of file-system-fold' when run as root.
* test-suite/tests/ftw.test ("file-system-fold")["EACCES"]: Use
  `pass-if-equal'.  Throw `unresolved' when run as root.
  Reported by Andreas Enge <andreas@enge.fr> at
  <http://lists.gnu.org/archive/html/bug-guix/2012-12/msg00073.html>.
2012-12-10 23:41:06 +01:00
Ludovic Courtès
cc94810708 Verify the value of `SHUT_RD' and related constants.
* libguile/socket.c: Add `verify' clauses for the values of `SHUT_RD',
  `SHUT_WR', and `SHUT_RDWR'.
2012-12-10 23:41:06 +01:00
Ludovic Courtès
4578dc9479 doc: Update `release.org'.
* doc/release.org (Use porter boxes): Mention Snakebite.
2012-12-10 23:41:06 +01:00
Mark H Weaver
8f63b9b670 Thanks Jozef Chraplewski.
* THANKS: Jozef Chraplewski.
2012-12-07 12:03:49 -05:00
Mark H Weaver
2355f01709 Avoid signed integer overflow in scm_product
* libguile/numbers.c (scm_product): Avoid signed integer overflow, which
  modern C compilers are allowed to assume will never happen, thus
  allowing them to optimize out our overflow checks.

* test-suite/tests/numbers.test (*): Add tests.
2012-12-07 12:02:07 -05:00
Daniel Hartwig
e6a730b22a doc: remove more references to hash-tables-as-vectors
* doc/ref/api-compound.texi (Hash Tables): Update.
2012-11-30 21:23:05 +01:00
Ludovic Courtès
3eaa587645 doc: Update `release.org'.
* doc/release.org: Fix typos, and update.
2012-11-30 21:22:45 +01:00
Ludovic Courtès
3b5390989d NEWS: Add "R6RS SRFI support" text.
* NEWS: Add proper text for "R6RS SRFI support", by Ian Price and
  Mark Weaver.
2012-11-30 00:48:53 +01:00
Ludovic Courtès
9a535f09e0 Bump version number for 2.0.7.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C
  function `scm_make_vtable_vtable'.
  (LIBGUILE_INTERFACE_AGE): Increment.
2012-11-30 00:06:26 +01:00
Mark H Weaver
3919585f79 NEWS: Add entry for new GUILE_LOAD_PATH (et al) ellipsis handling.
* NEWS: Add entry for new GUILE_LOAD_PATH (et al) ellipsis handling.
2012-11-29 17:57:49 -05:00
Mark H Weaver
2813d72571 NEWS: Mention par-for-each, alongside par-map, being fixed to use all cores
* NEWS: Mention par-for-each, alongside par-map, being fixed to use all
  cores.
2012-11-29 17:50:56 -05:00
Mark H Weaver
a94e7d85dd Minor fixes in NEWS
* NEWS: Minor fixes to the descriptions.
2012-11-29 17:25:21 -05:00
Ludovic Courtès
13fac28218 Update `NEWS'.
* NEWS: Add news for 2.0.7.
2012-11-29 22:44:12 +01:00
Ludovic Courtès
4d599c2441 futures: Remove circular dependency with (ice-9 threads).
* module/ice-9/futures.scm: Remove now-useless import of (ice-9 threads)
  introduced in commit be05b336.
2012-11-29 22:44:12 +01:00