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

15227 commits

Author SHA1 Message Date
Mark H Weaver
a2dead1b0f Improve code in scm_gcd for inum/inum case
* libguile/numbers.c (scm_gcd): Improve implementation of inum/inum case
  to be more clear and efficient.
2013-03-06 15:02:26 -05:00
Mark H Weaver
f57ea23ac8 Fix thread-unsafe lazy initializations.
* libguile/debug.c (scm_local_eval):
  libguile/ports.c (scm_current_warning_port):
  libguile/strports.c (scm_eval_string_in_module): Perform
  lazy-initialization while holding a mutex.  Use SCM_UNDEFINED as the
  uninitialized value.  Use 'scm_c_*_variable'.

* doc/ref/api-modules.texi (Accessing Modules from C): Fix
  'my_eval_string' example to be thread-safe.
2013-03-05 16:04:55 -05:00
Ludovic Courtès
29ace173b1 doc: Rename "Texinfo" node to "Texinfo Processing".
* doc/ref/texinfo.texi (Texinfo): Rename to...
  (Texinfo Processing): ... this.
* doc/ref/guile.texi (Guile Modules): Update menu.
2013-03-04 09:04:16 +01:00
Ludovic Courtès
69b6da07c3 Use `scm_is_eq' in filesys.c.
* libguile/filesys.c (is_file_name_separator): Use `scm_is_eq' instead
  of `=='.  Fixes <http://hydra.nixos.org/build/4261579>.
2013-03-04 08:57:08 +01:00
Bake Timmons
994d87be35 Improve keyword notation of Texinfo function definitions.
* doc/ref/api-debug.texi:
* doc/ref/api-evaluation.texi:
* doc/ref/api-modules.texi:
* doc/ref/compiler.texi:
* doc/ref/web.texi: Make Texinfo function headers more consistent.
  Change lesser used keyword notation to the predominant form.

* doc/ref/api-procedures.texi: Fix an argument name in a header that should
  use repeated argument notation.

* doc/ref/srfi-modules.texi: Update references in Texinfo function
  definition body to match previously updated variable notation in
  definition header.
2013-03-02 20:34:29 +01:00
Ludovic Courtès
183d2ace57 doc: Fix build with Texinfo 5.0.
* doc/ref/api-control.texi (Handling Errors): Move misplaced description
  for `scm_memory_error' & co.
* doc/ref/r6rs.texi (rnrs base): Change `deffnx' of `let-syntax' and
  `letrec-syntax' to fit on one line.
2013-03-01 17:50:05 +01:00
Ludovic Courtès
01b69e79f6 Allow the SMOB mark procedures to be called when libgc uses parallel markers.
Fixes <http://bugs.gnu.org/13611>.
Reported by Mike Gran <spk121@yahoo.com>.

* libguile/smob.c (current_mark_stack_pointer,
  current_mark_stack_limit): New variables.
  (smob_mark): Use CURRENT_MARK_STACK_POINTER and
  CURRENT_MARK_STACK_LIMIT instead of the same-named fields of
  `SCM_I_CURRENT_THREAD'.
  (scm_gc_mark): Likewise.
  (scm_smob_prehistory): Initialize CURRENT_MARK_STACK_LIMIT and
  CURRENT_MARK_STACK_POINTER.
* libguile/threads.h (scm_i_thread): Add comment that
  `current_mark_stack_ptr' and `current_mark_stack_limit' are no longer
  used.
2013-03-01 17:50:05 +01:00
Ludovic Courtès
0f595d7d1d Use accessors instead of symbols deprecated in libgc 7.3.
* configure.ac: Check for `GC_set_all_interior_pointers',
  `GC_get_gc_no', and `GC_set_java_finalization'.
* libguile/gc.c (scm_gc_stats)[HAVE_GC_GET_GC_NO]: Use `GC_get_gc_no'.
  (scm_storage_prehistory)[HAVE_GC_SET_ALL_INTERIOR_POINTERS]: Use
  `GC_set_all_interior_pointers'.
* libguile/guardians.c (scm_init_guardians)[HAVE_GC_SET_JAVA_FINALIZATION]:
  Use `GC_set_java_finalization'.
2013-03-01 17:50:05 +01:00
Daniel Hartwig
764246cfbb test-suite: eq-ness of numbers, characters is unspecified
* test-suite/tests/00-socket.test:
* test-suite/tests/alist.test:
* test-suite/tests/elisp.test:
* test-suite/tests/encoding-iso88591.test:
* test-suite/tests/encoding-iso88597.test:
* test-suite/tests/encoding-utf8.test:
* test-suite/tests/hash.test:
* test-suite/tests/i18n.test:
* test-suite/tests/modules.test:
* test-suite/tests/ports.test:
* test-suite/tests/srfi-35.test: Make tests use eqv? instead of eq? when
  comparing numbers, characters.  Checked also for similar uses of
  assq[-ref].

* test-suite/tests/vlist.test ("vhash-delete honors HASH"): Change test
  to use eqv-ness, not eq-ness, which should not impact its purpose as
  these two are equivalent for strings.
2013-03-01 11:03:22 -05:00
Mark H Weaver
8dd01861a9 Fix later-bindings-win logic in with-fluids.
Based on a patch by David Kastrup <dak@gnu.org>.
Fixes <http://bugs.gnu.org/13843>.

* libguile/fluids.c (scm_i_make_with_fluids): Reverse direction of inner
  loop that checks for duplicates, to properly handle more than two
  bindings to the same fluid.
2013-02-28 18:43:09 -05:00
Mark H Weaver
b8d8f8b929 Fix duplicate removal of with-fluids.
Based on a patch by David Kastrup <dak@gnu.org>.
Fixes <http://bugs.gnu.org/13838>.

* libguile/fluids.c (scm_i_make_with_fluids): Remove the duplicate
  binding instead of the last binding.

* test-suite/tests/fluids.test: Add test, and fix existing duplicate
  tests.

* THANKS: Thanks David Kastrup.
2013-02-28 06:26:22 -05:00
Mark H Weaver
5ccc3764b3 Support calling foreign functions of 10 arguments or more.
* libguile/foreign.c (OBJCODE_HEADER, META_HEADER, META): Change these
  into higher-order macros.
  (GEN_CODE): New higher-order macro based on 'CODE'.
  (M_STATIC, M_DYNAMIC): New macros.
  (CODE): Reimplement using 'GEN_CODE' and 'M_STATIC'.
  (make_objcode_trampoline): New static function.
  (large_objcode_trampolines, large_objcode_trampolines_mutex): New
  static variables.
  (get_objcode_trampoline): New static function.
  (cif_to_procedure): Use 'get_objcode_trampoline'.

* test-suite/standalone/test-ffi-lib.c (test_ffi_sum_many):
  New function.

* test-suite/standalone/test-ffi: Add test.
2013-02-28 04:11:35 -05:00
Ludovic Courtès
aacc689677 Fix handling of the *-gnux32 target.
* module/system/base/target.scm (triplet-pointer-size): Fix typo in the
  x32 triplet name.
* test-suite/tests/asm-to-bytecode.test (native-os): New procedure.
  (test-target): Use (native-word-size) only when both the CPU and OS
  match.
2013-02-28 09:42:45 +01:00
David Kastrup
a5d8f98c60 Let reverse! accept arbitrary types as second argument (new_tail)
* libguile/list.c (scm_reverse_x): remove typecheck for 2nd arg.

Signed-off-by: Mark H Weaver <mhw@netris.org>
2013-02-27 20:46:58 -05:00
Ludovic Courtès
b946e08a6a Recognize the `x86_64.*-gnux32' triplet.
* module/system/base/target.scm (triplet-pointer-size): Add case for
  "^x64_64-.*-gnux32".
* test-suite/tests/asm-to-bytecode.test ("cross-compilation"):
  ["x86_64-unknown-linux-gnux32"]: New test.
2013-02-27 20:40:08 +01:00
Ludovic Courtès
9130ec74cf Check whether a triplet's OS part specifies an ABI.
* module/system/base/target.scm (cpu-word-size): Rename to...
  (triplet-pointer-size): ... this.  Update caller.  Take a triplet as
  the argument.  Check the `triplet-os' part when checking for equality
  with the host.  Add support "mips64.*-gnuabi64".
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")
  [ "mips64el-unknown-linux-gnuabi64"]: New test.
2013-02-27 20:40:08 +01:00
Ludovic Courtès
cc2948aa31 Recognize mips64* as having 32-bit pointers by default.
* module/system/base/target.scm (cpu-word-size): Consider MIPS64 to
  default to n32 or o32.
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")
  ["mips64el-unknown-linux-gnu"]: New test.
2013-02-27 20:40:08 +01:00
Ludovic Courtès
4124994771 tests: Avoid missing missing-prototype warning with <fenv.h> on glibc 2.17.
* test-suite/standalone/test-round.c: Avoid missing-prototype warning
  with <fenv.h> on glibc 2.17.
2013-02-27 20:40:07 +01:00
Ludovic Courtès
94a7029acf Fix cross-compilation of `c-tokenize.o'.
* libguile/Makefile.am (c-tokenize.$(OBJEXT)): Pass -I$(top_builddir)
  when cross-compiling.
2013-02-27 20:40:07 +01:00
Mark H Weaver
be6a36a05d Update copyright dates on random.c
* libguile/random.c: Add 2012 and 2013 to the copyright notice.
2013-02-25 22:14:41 -05:00
Mark H Weaver
587f4edd39 random_state_of_last_resort: use getpid directly, instead of scm_getpid
* libguile/random.c: Include <sys/types.h> and <unistd.h> (if present).
  (random_state_of_last_resort): Use getpid directly.
2013-02-25 13:53:49 -05:00
Mark H Weaver
3ec19a7884 Revert "random_state_of_last_resort doesn't rely on HAVE_POSIX"
This reverts commit eaf21539d4.
2013-02-25 13:33:28 -05:00
Mark H Weaver
444b26f739 Revert "random-state-from-platform: simplify pid conditional, and clarify docs."
This reverts commit 08904661a2.
2013-02-25 13:33:14 -05:00
Mark H Weaver
08904661a2 random-state-from-platform: simplify pid conditional, and clarify docs.
* libguile/random.c (random_state_of_last_resort): Simplify optional
  inclusion of PID in the random state.  Clarify in the comments that
  the PID is only included where scm_getpid is present.

* doc/ref/api-data.texi (Random): Clarify that
  'random-state-from-platform' includes the PID in the random state only
  if scm_getpid is present.
2013-02-24 19:57:00 -05:00
Andy Wingo
c085589b1c remove language/glil/decompile-assembly.scm
* module/language/glil/decompile-assembly.scm: Remove.  This module
  never worked, and even failed to compile.

* module/language/glil/spec.scm:
* module/Makefile.am: Remove references to (language glil
  decompile-assembly).
2013-02-24 15:50:09 +01:00
Andy Wingo
72ad03fcbd deprecate (ice-9 mapping)
* module/ice-9/mapping.scm: Add deprecation warning.
2013-02-24 15:11:14 +01:00
Daniel Hartwig
1746b8ffdb fix and update (ice-9 mapping)
* module/ice-9/mapping.scm (mapping-create-handle!): INIT is required.
  (mapping-ref): Rewrite.  Fix problem with DFLT.
  (hash-table-mapping-hooks): Drop DELETE-PROC, hash-table accessors
  only use ASSOC-PROC.  Add INIT to create-handle hook.  Use correct
  hash-table accessors.
  (make-hash-table-mapping): Drop DELETE-PROC.
  (hash-table-mapping): Rewrite.  Drop DELETE-PROC.
2013-02-24 14:41:56 +01:00
Andy Wingo
7a17979ea4 cleanup to filesys.c's handling of file name separators
* libguile/filesys.c (is_file_name_separator): New helper, as in
  load.c.
  (scm_dirname, scm_basename, scm_i_relativize_path): Use
  is_file_name_separator.
2013-02-24 14:20:18 +01:00
Andy Wingo
c21939bc24 simplify scm_stat on mingw
* libguile/filesys.c (scm_stat): Don't munge the filename on MinGW;
  gnulib does that for us.
2013-02-24 14:18:29 +01:00
Andy Wingo
4bab7f01be load.c uses same logic as boot-9 for file names
* libguile/load.c (is_file_name_separator, is_drive_letter):
  (is_absolute_file_name): New helpers, like the ones in boot-9.
  Perhaps we should just define them in C.
  (search_path, scm_try_auto_compile, canonical_suffix): Rewrite using
  the new helpers.
2013-02-24 14:18:27 +01:00
Andy Wingo
65fa392306 allow '/' in the prefix of UNC file names on windows
* module/ice-9/boot-9.scm (absolute-file-name?) [WINDOWS]: Allow '/' as
  well as '\' when detecting UNC names.
  (load-in-vicinity): Add a comment about the purpose of
  canonical->suffix.
2013-02-24 13:03:42 +01:00
Andy Wingo
eaf21539d4 random_state_of_last_resort doesn't rely on HAVE_POSIX
* libguile/random.c (random_state_of_last_resort): Add the PID as a seed
  only if we have scm_getpid().
2013-02-24 12:46:48 +01:00
Mike Gran
99d1843e2a Update predefined character sets to Unicode 6.2
* libguile/srfi-14.i.c (cs_graphic_ranges, cs_printing_ranges, cs_symbol_ranges)
  (cs_designated_ranges): modified
2013-02-21 06:44:42 -08:00
Andy Wingo
f5ea559aa0 net_db.c doesn't import winsock2.h
* libguile/net_db.c: Don't include winsock2.h; gnulib handles this for
  us as necessary.
2013-02-20 22:57:02 +01:00
Andy Wingo
0e42886088 mkstemp uses O_BINARY
* libguile/mkstemp.c (mkstemp): Add O_BINARY.  Since temp files are
  empty at the beginning, we're not changing the behavior for reading
  files.  For writing files `newline' and ~% can add \r elements as
  needed.  So this is a reasonable thing to do, and it prevents mangling
  of temp files for the compiler.
2013-02-20 21:20:55 +01:00
Andy Wingo
90f51aba0d fix compilation of functions with more than 255 local variables.
* module/language/glil/compile-assembly.scm (glil->assembly): Fix case
  where there are more than 255 local variables.  Whoops!
2013-02-20 16:02:30 +01:00
Andy Wingo
e716f4410f fix an error message loading invalid bytecode
* libguile/objcodes.c (make_objcode_from_file): Add correct error
  message if full_read failed without an errno.
2013-02-19 23:03:19 +01:00
Andy Wingo
5a4a4454c5 copy-file and load-objcode use O_BINARY
* libguile/filesys.c (scm_copy_file):
* libguile/objcodes.c (scm_load_objcode): Use O_BINARY.  Thanks to Eli
  Zaretskii for the patch.
2013-02-19 22:36:22 +01:00
Eli Zaretskii
854ada4f1a Fix startup of guile.exe on MS-Windows.
* module/system/base/compile.scm (call-with-output-file/atomic):  Call
  close-port before deleting the temporary file name, otherwise deletion
  fails on MS-Windows (cannot delete a file that is still open).
2013-02-19 16:34:50 +01:00
Andy Wingo
0725031fe3 add link to doc about UNC names
* module/ice-9/boot-9.scm (compile-time-case): Add link to docs about
  UNC names.
2013-02-19 15:09:32 +01:00
Andy Wingo
9b6316eabc better handling of windows file name conventions
* libguile/filesys.c (scm_system_file_name_convention): New function.
  Exported to Scheme only.

* module/ice-9/boot-9.scm (file-name-separator?, absolute-file-name?):
  New predicates.
  (file-name-separator-string): New global variable.
  (in-vicinity): Use the new procedures.
  (load-user-init, try-module-autoload): Use file-name-separator-string.
  (load-in-vicinity): Update canonical->suffix.  Consistently use the
  term "file name" throughout.

* module/ice-9/psyntax.scm (include): Use global `absolute-file-name?'.

* module/ice-9/psyntax-pp.scm: Regenerate.
2013-02-19 15:00:11 +01:00
Mark H Weaver
90a1623232 Remove flawed test that assumed (eq? 1/2 2/4) would return false.
* test-suite/tests/hash.test ("hash-count"): Remove flawed test.
2013-02-18 18:44:15 -05:00
Ludovic Courtès
6f160a6e99 build: Fix compilation of `c-tokenize.c' with latest Gnulib.
* libguile/c-tokenize.lex: Include <config.h>, to pull in Gnulib macro
  definitions now required.
2013-02-18 21:43:30 +01:00
Andy Wingo
84ebfef4e6 add gnulib `times' module
* lib: Add `times' module.  Should fix socket.c on MinGW.  Thanks to Eli
  Zaretskii for the report.
2013-02-18 19:06:34 +01:00
Andy Wingo
3dac6181c1 Add gnulib `select' module.
Should fix fport_input_waiting when neither poll nor select nor FIONREAD
are available, which is the case on MinGW.  Thanks to Eli Zaretskii for
the report.
2013-02-18 18:53:46 +01:00
Andy Wingo
af07e10429 Update to gnulib 0.0.7865-a828. 2013-02-18 18:48:48 +01:00
Daniel Llorens
739941679c Array documentation fixes
* libguile/generalized-arrays.c: Fix wording of docstring for array-length.
* doc/ref/api-compund.texi:
  - Document scm_array_type(), scm_array_ref(), array-length,
    scm_array_length(), scm_c_array_length().
  - Fix wording of documentation for array-in-bounds?
2013-02-18 16:57:16 +01:00
Andy Wingo
118ff892be deprecate generalized vectors in favor of arrays
* libguile/generalized-arrays.h:
* libguile/generalized-arrays.c (scm_c_array_length):
  (scm_array_length): New functions.

* module/ice-9/deprecated.scm:
* libguile/generalized-vectors.c:
* libguile/generalized-vectors.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_generalized_vector_p)
  (scm_generalized_vector_length, scm_generalized_vector_ref)
  (scm_generalized_vector_set_x, scm_generalized_vector_to_list):
  Deprecate.

* libguile/uniform.c (scm_uniform_vector_to_list): Use
  scm_array_to_list.

* module/ice-9/boot-9.scm (case): Arrays are generalized vectors.

* module/srfi/srfi-4/gnu.scm (define-any->vector): Use the array
  functions instead of the generalized-vector functions.

* test-suite/tests/arrays.test: Remove generalized-vector->list test;
  covered by array->list test.

* test-suite/tests/bitvectors.test:
* test-suite/tests/bytevectors.test:
* test-suite/tests/srfi-4.test: Adapt to test using array interfaces
  instead of generalized-vector interfaces.

* doc/ref/api-compound.texi: Remove generalized vector docs.
* doc/ref/api-data.texi:
* doc/ref/srfi-modules.texi: Adapt.
2013-02-18 16:57:15 +01:00
Andy Wingo
336c921146 optimize access to arrays of rank 1 or 2
* libguile/array-handle.c (scm_array_handle_pos_1):
  (scm_array_handle_pos_2): New functions.

* libguile/generalized-arrays.c (scm_c_array_ref_1, scm_c_array_ref_2):
  (scm_c_array_set_1_x, scm_c_array_set_2_x): New functions.
  (scm_i_array_ref, scm_i_array_set_x): New subr bindings for array-ref
  and array-set! that avoid consing for arrays of rank 1 or 2.

* test-suite/tests/arrays.test ("array-set!"): Fix expected exception
  for wrong number of indices.
2013-02-18 16:38:24 +01:00
Andy Wingo
18cd9aff94 array handle inline functions defined in array-handle.h.
* libguile/inline.h:
* libguile/array-handle.h (scm_array_handle_ref):
  (scm_array_handle_set): Move definitions here from inline.h.

* libguile/inline.c: Include array-handle.h.
2013-02-18 12:46:00 +01:00