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

16114 commits

Author SHA1 Message Date
Mark H Weaver
c8248c8ed5 Optimize scm_i_divide2double for integers less than 2^DBL_MANT_DIG.
* libguile/numbers.c (scm_i_divide2double): Optimize for common case
  when both operands are less than 2^DBL_MANT_DIG (normally 2^53).
2013-03-19 22:41:18 -04:00
Mark H Weaver
1d64b4edb9 SRFI-45: Support multiple values; add promise? predicate.
* module/srfi/srfi-45.scm (eager): Accept any number of arguments.
  Store the list of arguments in the value record.  Previously, only one
  argument was accepted, and that value was stored in the value record.
  (delay): Support expressions that return any number of arguments.
  (force): Return the list of values stored in the value record.
  (promise?): Export.

* doc/ref/srfi-modules.texi (SRFI-45): Update docs.  Remove typing
  for simplicity in discussing multiple values.

* test-suite/tests/srfi-45.test: Add tests.  Add FSF copyright for 2010
  and 2013.  Add missing year to André van Tonder's copyright notice.
2013-03-19 10:29:44 -04:00
Mark H Weaver
8150dfa1f2 Use scientific notation only if there are enough trailing zeroes.
* libguile/numbers.c (idbl2str): Print large numbers in scientific
  notation only if the exponent is >= 7 and the least significant
  non-zero digit has value >= radix^4.

* test-suite/tests/numbers.test ("number->string"): Add tests.
2013-03-19 03:38:15 -04:00
Ludovic Courtès
a9ea4f909b Avoid rebuild of `guile.info' at the user's site.
* configure.ac: Remove `doc/ref/effective-version.texi' from the
  `AC_CONFIG_FILES'.
* doc/ref/Makefile.am ($(srcdir)/effective-version.texi): New target.
2013-03-18 22:30:13 +01:00
Ludovic Courtès
e5029c5853 Use byte-oriented functions in `get-bytevector*'.
* libguile/r6rs-ports.c (scm_get_bytevector_some, scm_get_bytevector_n,
  scm_get_bytevector_n_x, scm_get_bytevector_all): Use
  `scm_get_byte_or_eof' and `scm_peek_byte_or_eof' instead of their
  `char' counterparts.
  Reported by Chris K. Jester-Young.
2013-03-18 22:30:13 +01:00
Ludovic Courtès
5f24f1b53e Define the new Linux-specific `SO_REUSEPORT'.
* libguile/socket.c (scm_init_socket)[SO_REUSEPORT]: Define
  `SO_REUSEPORT'.
  (scm_setsockopt, scm_getsockopt): Update docstring.
* doc/ref/posix.texi (Network Sockets and Communication): List
  `SO_REUSEPORT'.
2013-03-18 22:30:13 +01:00
Mark H Weaver
1ea37620c2 Reimplement idbl2str number printer.
Fixes <http://bugs.gnu.org/13757>.

* libguile/numbers.c (idbl2str): Reimplement.
  (mem2decimal_from_point): Accept negative exponents larger than
  SCM_MAXEXP that produce subnormals.
  (SCM_MAX_DBL_PREC): Removed preprocessor macro.
  (scm_dblprec, fx_per_radix): Removed static variables.
  (init_dblprec, init_fx_radix): Removed static functions.
  (scm_init_numbers): Remove initialization code for 'scm_dblprec'
  and 'fx_per_radix'.

* test-suite/tests/numbers.test ("number->string"): Restore tests that
  previously failed.  Remove comments about problems in the number
  printer that are now fixed.
2013-03-17 18:52:31 -04:00
Mark H Weaver
9823778490 Improve inexact division of exact integers.
* libguile/numbers.c (scm_i_divide2double): New function.
  (scm_i_divide2double_lo2b): New variable.
  (scm_i_fraction2double, log_of_fraction): Use 'scm_i_divide2double'.
  (do_divide): Removed.  Its code is now in 'scm_divide'.
  (scm_divide2real): Removed.  Superceded by 'scm_i_divide2double'.
  (scm_divide): Inherit code from 'do_divide', but without support for
  forcing a 'double' result (that functionality is now implemented by
  'scm_i_divide2double').  Add FIXME comments in cases where divisions
  might not be as precise as they should be.
  (scm_init_numbers): Initialize 'scm_i_divide2double_lo2b'.

* test-suite/tests/numbers.test (dbl-epsilon-exact, dbl-max-exp): New
  variables.
  ("exact->inexact"): Add tests.
  ("inexact->exact"): Add test for largest finite inexact.
2013-03-17 16:37:55 -04:00
Daniel Hartwig
b1c46fd30a http: support IP-literal (IPv6 address) in Host header
* module/web/http.scm ("Host"): Parse and write IP-literals treating
  escapes as uri module does: remove brackets on parse, replace them on
  write.
* test-suite/tests/web-http.test ("request headers"): Add tests.
2013-03-16 19:53:07 +08:00
Daniel Hartwig
2e08ff38b7 add tests for read-request-line, etc.
* test-suite/web/web-http.test ("read-request-line"):
  ("write-request-line", "read-response-line", "write-response-line"):
  Add.
2013-03-16 17:56:08 +08:00
Daniel Hartwig
dc87126115 minor tweaks to web documentation
* doc/ref/web.texi: Say `World Wide Web'; the hyphenated form is almost
  never used (c.f. w3.org).

  General predicate arguments are named `obj'.  Fill in arguments
  omitted from some procedure definitions (e.g. `request-method').

  Minor tweaks, such as using en-dash and missing markup as appropriate.
  Wrap very long deffn lines.

* module/web/*.scm: Expand texinfo markup in doc strings.  Synchronize
  with changes in web.texi.
2013-03-16 17:53:53 +08:00
Andy Wingo
01b83dbd1a more NEWS
* NEWS: Update.
2013-03-15 22:21:34 +01:00
Andy Wingo
f361bb937a incremental NEWS work
* NEWS: Checkpoint.
2013-03-15 21:13:27 +01:00
Andy Wingo
912f5f3445 fix doc build
* doc/ref/api-data.texi (Bitwise Operations): Don't use @-commands in
  @math.  Fixes doc build.
* doc/ref/api-macros.texi (Syntax Rules): Fix example result.
2013-03-15 19:22:18 +01:00
Andy Wingo
de2811cc41 very beginnings of NEWS
* NEWS: A very very very rough start at 2.0.8 news
2013-03-13 23:22:34 +01:00
Andy Wingo
8ae26afefe add #:resolve-syntax-parameters? kwarg to syntax-local-binding
* doc/ref/api-macros.texi (Syntax Transformer Helpers): Document.

* module/ice-9/psyntax.scm (syntax-local-binding): Add
  #:resolve-syntax-parameters? kwarg.  Fixes bug 10991.
* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syncase.test ("syntax-local-binding"): Add test.
2013-03-13 11:43:35 +01:00
Andy Wingo
dbab8aaaca allow for spurious wakeups from pthread_cond_wait
* libguile/threads.c (scm_call_with_new_thread, scm_spawn_thread): Allow
  for spurious wakeups while waiting on cond variables.  Should fix bug
  10641.
2013-03-13 11:01:38 +01:00
Andy Wingo
dfd1d3b144 failing to load module in psyntax indicates an identifier is not macro
* module/ice-9/boot-9.scm (false-if-exception): Add optional #:warning
  TEMPLATE ARG... tail, which indicates that we should print a warning
  on failure.
  (load-in-vicinity): Use the new #:warning.
  (make-autoload-interface): Surround the bits that load modules with a
  false-if-exception with #:warning.  Fixes
  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12202.

* test-suite/tests/syncase.test ("missing autoloads do not foil
  psyntax"): Add a test.
2013-03-13 10:04:47 +01:00
Mark H Weaver
24475b860b Reimplement 'inexact->exact' to avoid mpq functions.
* libguile/numbers.c (scm_inexact_to_exact): Implement conversion of a
  double to an exact rational without using the mpq functions.

* test-suite/tests/numbers.test (dbl-mant-dig): Simplify initializer.
  (dbl-epsilon, dbl-min-exp): New variables.
  ("inexact->exact"): Add tests.  Fix broken "2.0**i to exact and back"
  test, and change it to "2.0**i to exact", to avoid use of
  'exact->inexact'.
2013-03-12 15:39:34 -04:00
Mark H Weaver
7f34acd8a4 Optimize logarithms using scm_i_big2dbl_2exp
* libguile/numbers.c (log_of_exact_integer_with_size): Removed.

  (log_of_exact_integer): Handle bignums too large to fit in a double
  using 'scm_i_big2dbl_2exp' instead of 'scm_integer_length' and
  'scm_ash'.

  (log_of_fraction): Use 'log_of_exact_integer' instead of
  'log_of_exact_integer_with_size'.
2013-03-12 15:39:30 -04:00
Mark H Weaver
1eb6a33a30 Simplify and improve scm_i_big2dbl, and add scm_i_big2dbl_2exp
* libguile/numbers.c (scm_i_big2dbl_2exp): New static function.
  (scm_i_big2dbl): Reimplement in terms of 'scm_i_big2dbl_2exp',
  with proper rounding.

* test-suite/tests/numbers.test ("exact->inexact"): Add tests.
2013-03-12 15:39:25 -04:00
Mark H Weaver
e08a12b535 Add 'round-ash', a rounding arithmetic shift operator
* libguile/numbers.c (left_shift_exact_integer,
  floor_right_shift_exact_integer, round_right_shift_exact_integer): New
  static functions.

  (scm_round_ash): New procedure.

  (scm_ash): Reimplement in terms of 'left_shift_exact_integer' and
  'floor_right_shift_exact_integer'.

* libguile/numbers.h: Add prototype for scm_round_ash.  Rename the
  second argument of 'scm_ash' from 'cnt' to 'count'.

* test-suite/tests/numbers.test (round-ash, ash): Add new unified
  testing framework for 'ash' and 'round-ash'.  Previously, the tests
  for 'ash' were not very comprehensive; for example, they did not
  include a single test where the number to be shifted was a bignum.

* doc/ref/api-data.texi (Bitwise Operations): Add documentation for
  'round-ash'.  Improve documentation for `ash'.
2013-03-12 15:39:20 -04:00
Mark H Weaver
a285b18ca8 Optimize and simplify fractions code.
* libguile/numbers.c (scm_exact_integer_quotient,
  scm_i_make_ratio_already_reduced): New static functions.

  (scm_i_make_ratio): Rewrite in terms of
  'scm_i_make_ratio_already_reduced'.

  (scm_integer_expt): Optimize fraction case.

  (scm_abs, scm_magnitude, scm_difference, do_divide): Use
  'scm_i_make_ratio_already_reduced'.

* test-suite/tests/numbers.test (expt, integer-expt): Add tests.
2013-03-12 15:39:16 -04:00
Mike Gran
d2df3950a9 Add standalone test for smob marking
* test-suite/standalone/Makefile.am (TESTS, check_PROGRAMS): add test-smob-mark
  (test_smob_mark_SOURCES, test_smob_mark_CFLAGS, test_smob_mark_LDADD): new variables
* test-suite/standalone/test-smob-mark.c: new file
2013-03-10 19:43:38 -07:00
Jason Earl
b5870f25ad rely on gnulib for `poll'
* configure.ac:
* libguile/fports.c (fport_input_waiting):
* libguile/poll.c (scm_primitive_poll): Rely on gnulib to provide poll
  for us.
2013-03-10 23:44:23 +01:00
Jason Earl
428f9e95fc import `poll' from gnulib
* lib/Makefile.am:
* lib/poll.c:
* lib/poll.in.h:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4:
* m4/poll.m4:
* m4/poll_h.m4: Add poll gnulib module.
2013-03-10 23:40:13 +01:00
Andy Wingo
ccd0ae1fbb guile.m4 allows selection of guile 2.0, 1.8, etc.
* meta/guile.m4 (GUILE_PKG): New macro, chooses a version of Guile
  against which to compile.
  (GUILE_FLAGS, GUILE_PROGS): Rewrite to call GUILE_PKG as necessary, to
  respect any previous call to GUILE_PKG, and to not require
  guile-tools.
2013-03-10 23:34:50 +01:00
Jason Earl
988ca6b212 add %site-ccache-dir
* libguile/load.h:
* libguile/load.c (scm_sys_site_ccache_dir): New procedure.

* doc/ref/scheme-using.texi (Installing Site Packages):
* doc/ref/api-options.texi (Build Config): Add docs.

Fixes bug 10326.
2013-03-10 23:20:22 +01:00
Jason Earl
a4b4fbbdaa excise use of "iff" in the manual
* doc/ref/api-compound.texi:
* doc/ref/api-control.texi:
* doc/ref/api-data.texi:
* doc/ref/api-macros.texi:
* doc/ref/api-modules.texi:
* doc/ref/api-procedures.texi:
* doc/ref/api-scheduling.texi:
* doc/ref/api-smobs.texi:
* doc/ref/api-undocumented.texi:
* doc/ref/api-utility.texi:
* doc/ref/compiler.texi:
* doc/ref/intro.texi:
* doc/ref/scheme-using.texi:
* doc/ref/sxml.texi:
* doc/ref/web.texi: Change uses of "iff" to "if, otherwise".  Fixes bug
  10302.
2013-03-10 22:29:18 +01:00
Jason Earl
e9381f58d1 fix AC_CHECK_DECLS for `alarm'
* configure.ac: Fix decl check for `alarm'.
2013-03-10 20:20:49 +01:00
Jason Earl
cfe24bc4de use chmod portably in (system base compile)
* module/system/base/compile.scm (call-with-output-file/atomic): Call
  chmod with the file name instead of the port.
2013-03-10 20:12:09 +01:00
Jason Earl
84dfde82ae fix response-body-port for responses without content-length
* module/web/response.scm (response-body-port): Correctly handle cases
  in which EOF terminates the body.
2013-03-10 19:23:31 +01:00
Andy Wingo
94c53e0601 provide getlogin declaration if needed.
* configure.ac: Check for getlogin decl.
* libguile/posix.c: Declare getlogin if needed.
2013-03-09 23:55:01 +01:00
Andy Wingo
aa59904eae fix mingw issues with posix.c
* libguile/posix.c (scm_execl, scm_execlp, scm_execle)
  (scm_open_process): Remove casts for ancient mingw.
  (scm_utime): If we fall back to utime, assert that flags is 0.
  (scm_getlogin): Rely on gnulib.
2013-03-09 23:12:51 +01:00
Andy Wingo
b7548cd2dc add getlogin from gnulib
* lib/Makefile.am:
* lib/getlogin.c:
* m4/getlogin.m4:
* m4/gnulib-cache.m4: Add getlogin module.
2013-03-09 23:09:44 +01:00
Andy Wingo
6ab4de6125 don't provide scm_std_select on mingw and similar platforms
* libguile/iselect.h: If we do not have sys/select.h, don't provide
  scm_std_select, SELECT_TYPE, FD_SET, FD_ZERO, FD_ISSET, or FD_CLR.
  Guile should not be setting these macros in public API.  This is an
  incompatible change on mingw, but oh well.

* libguile/threads.c: Rely on gnulib's select, and use that to implement
  scm_std_select.

* libguile/deprecated.h:
* libguile/deprecated.c: Only provide scm_internal_select if we have
  sys/select.h.
2013-03-09 22:45:33 +01:00
Andy Wingo
d3c88f1826 simplify posix.c
* libguile/posix.c: Reorder includes to fix mingw include-order
  problem.  Remove ttyname shims; gnulib is the place to fix that.
  Remove winsock2 include, as gnulib seems to handle that OK.  Rely on
  the new pipe-posix gnulib module.  Don't bother shimming getlogin, etc
  on mingw; gnulib is the place for shims.
2013-03-09 22:42:17 +01:00
Andy Wingo
7dfcaf2616 simplify readline.c
* guile-readline/readline.c: Remove all mingw special-casing, relying
  instead on mingw / gnulib doing the right thing.
2013-03-09 22:40:18 +01:00
Andy Wingo
3baf6e8b05 simplify stime back-compat shims for tzname
* libguile/stime.c: Remove tzname declarations for ancient mingw and SGI
  RS6000.
2013-03-09 22:39:27 +01:00
Andy Wingo
b0dbbacbe4 mingw include order for socket.c
* libguile/socket.c: Reorder includes to fix include order on mingw.
2013-03-09 22:38:21 +01:00
Andy Wingo
ce09e6bd0f fix include-order problem in net_db.c for mingw
* libguile/net_db.c: Reorder includes to avoid include-order problem on
  mingw.
2013-03-09 22:37:29 +01:00
Andy Wingo
14b59d6102 silence mingw32 warning in i18n.c
* libguile/i18n.c (scm_make_locale): Silence a warning.
2013-03-09 22:34:06 +01:00
Andy Wingo
629987edfb fports uses gnulib's select
* libguile/fports.c: Reorder includes to put system includes first;
  fixes windows/winsock2 include error problem.  Rely on Gnulib's
  select module.
  (fport_input_waiting): Use select instead of scm_std_select.
2013-03-09 22:33:24 +01:00
Andy Wingo
ba59471eee simplify filesys.c via gnulib's select and fstat modules
* libguile/filesys.c: Instead of using scm_std_select, just use select,
  relying on gnulib to provide it to us.  Likewise, rely on fstat.
2013-03-09 22:30:26 +01:00
Andy Wingo
eac7a5d039 if we have threads on windows, we have pthreads; inform bdw-gc of that
* libguile/bdw-gc.h: If we have threads enabled on mingw32, explicitly
  mark GC_WIN32_PTHREADS.  See
  http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/5564
  for more info.
2013-03-09 22:27:59 +01:00
Andy Wingo
44e30ef241 remove init.c iselect include
* libguile/init.c: Remove iselect include.
2013-03-09 22:26:16 +01:00
Andy Wingo
cdd125e8d4 portability simplification with scmsigs.c and alarm
* configure.ac (alarm): Check for decl.
* libguile/scmsigs.c: Reorder includes to put system includes first.
  Fixes include order on mingw.  Remove #define for alarm, as we will
  use HAVE_DECL_ALARM.  Remove #defines for sleep and usleep, as they
  are not used.
  (scm_alarm): Only define if HAVE_DECL_ALARM.
2013-03-09 22:25:35 +01:00
Andy Wingo
4fd38267bc add gnulib fstat module explicitly
* lib/Makefile.am:
* m4/gnulib-cache.m4: Explicitly add fstat module.
2013-03-09 21:06:07 +01:00
Andy Wingo
1adba49ab2 Import `pipe-posix' module from gnulib.
* lib/Makefile.am:
* lib/pipe.c:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4:
* m4/pipe.m4: Add pipe-posix module.
2013-03-09 19:08:51 +01:00
Andy Wingo
09b204d387 squish remove some mingw-specific code that is covered by gnulib
* libguile/socket.c (scm_init_socket): Remove mingw-specific code.

* libguile/fports.c: Remove ftruncate redefine; mingw is fine.
  (scm_i_fdes_to_port): If we have no F_GETFL, just do an fstat.  The
  right place for an F_GETFL replacement would be in gnulib.
  (fport_input_waiting): Remove an outdated comment.

* libguile/error.c (SCM_I_STRERROR, SCM_I_ERRNO): Remove, replacing uses
  with strerror and errno.

* libguile/win32-socket.c:
* libguile/win32-socket.h: Remove.  Mingw has suitable replacements.

* configure.ac:
* libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  (noinst_HEADERS): Update for win32-socket removal.
2013-03-09 16:47:21 +01:00