summaryrefslogtreecommitdiff
path: root/libguile
AgeCommit message (Collapse)AuthorFilesLines
2012-01-23Print the address of hash tables.Ludovic Courtès1-2/+5
* libguile/hashtab.c (scm_i_hashtable_print): Print the address of EXP.
2012-01-22Parenthesize and type `SCM_FRAME' macros; check layout of `scm_vm_frame'.Ludovic Courtès3-7/+16
* libguile/frames.c: Add compile-time assertions on the layout of `struct scm_vm_frame'. (RELOC): Parenthesize and type VAL. * libguile/frames.h (SCM_FRAME_STRUCT): Write in terms of `SCM_FRAME_DATA_ADDRESS'. (SCM_FRAME_DATA_ADDRESS): Parenthesize and type FP. (SCM_FRAME_SET_DYNAMIC_LINK): Write in terms of `SCM_FRAME_DYNAMIC_LINK'. * libguile/vm.c (RELOC): Parenthesize and type SCM_P.
2012-01-21Universally-unique gensymsMark H Weaver3-11/+44
* libguile/symbols.c (scm_gensym): Make the gensym counter a 128-bit thread-local, initialized to a random number upon the first call to `gensym' within a given thread. This counter is rendered as a 22 byte suffix of mostly base64 digits. * libguile/threads.h (scm_i_thread): Add a thread-local gensym_counter. * libguile/threads.c (guilify_self_1): Initialize gensym_counter to NULL.
2012-01-21Add `random-state-from-platform' and `scm_i_random_bytes_from_platform'Mark H Weaver2-0/+104
* libguile/random.c (scm_random_state_from_platform): New procedure. (scm_i_random_bytes_from_platform): New internal function. * libguile/random.h (scm_random_state_from_platform, scm_i_random_bytes_from_platform): Add prototypes. * doc/ref/api-data.texi (Random): Add documentation.
2012-01-18Add `scm_c_value_ref' to allow access to multiple returned values from CMark H Weaver2-0/+26
Based on a patch by Julian Graham <julian@member.fsf.org> * libguile/values.c, libguile/values.h (scm_c_value_ref): New function. * doc/ref/api-control.texi (Multiple Values): Add documentation. * test-suite/standalone/test-scm-values.c: New test program. * test-suite/standalone/Makefile.am: Add test-scm-values test.
2012-01-16Update Gnulib to v0.0-6827-g39c3009; use the `dirfd' module.Ludovic Courtès1-27/+5
* m4/gnulib-cache.m4: Use `dirfd'. * libguile/filesys.c: Include Gnulib's <dirent.h> directly. (dirfd): Remove. Suggested by Bruno Haible <bruno@clisp.org>.
2012-01-16Fix typo in threads.c on IA64.Ludovic Courtès1-1/+1
* libguile/threads.c (guilify_self_1)[__ia64__]: Fix typo. Reported by Bruno Haible <bruno@clisp.org>.
2012-01-15Add #ifdefs for langinfo items that don't exist on OpenBSD.Chris K. Jester-Young1-0/+10
* libguile/i18n.c (define_langinfo_items): Add #ifdefs for ERA_* and ALT_DIGITS, as those constants don't exist on OpenBSD.
2012-01-14Fix signed/unsigned pointer mismatches.Ludovic Courtès1-3/+4
* libguile/foreign.c (scm_pointer_to_bytevector, scm_bytevector_to_pointer): Use pointers of the same signedness.
2012-01-12fix array printingAndy Wingo1-1/+2
* libguile/print.c (iprin1): Fix unmatched ENTER_NESTED_DATA. Fixes http://debbugs.gnu.org/10482. Thanks to Daniel Llorens for the report.
2012-01-12Make sure `scm_spawn_thread' returns a thread.Ludovic Courtès1-0/+2
* libguile/threads.c (scm_spawn_thread): Add an assertion that DATA.thread is a thread. This assertion is sometimes hit on x86_64-freebsd8.2.
2012-01-12fluids.c docstringAndy Wingo1-2/+3
* libguile/fluids.c (scm_make_fluid_with_default): Update docstring.
2012-01-10Use a common null stringbuf in `scm_i_make_string'Mark H Weaver1-1/+15
* libguile/strings.c (scm_i_make_string): Use a common null stringbuf for newly-allocated empty strings.
2012-01-10Empty substrings no longer reference the original stringbufMark H Weaver1-19/+31
* libguile/strings.c (scm_i_substring, scm_i_substring_read_only, scm_i_substring_shared): When asked to create an empty substring, return a freshly allocated null string. Previously, an empty substring needlessly held a reference to the original stringbuf.
2012-01-10scm_i_substring_copy tries to narrow the substringMark H Weaver1-5/+8
* libguile/strings.c (scm_i_substring_copy): Try to narrow the substring if it came from a wide string.
2012-01-10Avoid calling `u32_conv_from_encoding' on the null stringMark H Weaver1-2/+2
* libguile/strings.c (scm_from_stringn): Avoid calling `u32_conv_from_encoding' on the null string, by using the same fast-path code used if (encoding == NULL). This is an optimization, and also avoids any possible encoding errors.
2012-01-10Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo22-161/+220
Conflicts: libguile/__scm.h libguile/array-map.c libguile/procprop.c libguile/tags.h module/ice-9/deprecated.scm module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm test-suite/standalone/test-num2integral.c test-suite/tests/regexp.test
2012-01-09Remove null string optimization from scm_from_stringnMark H Weaver1-2/+0
* libguile/strings.c (scm_from_stringn): Always return a freshly allocated string from scm_from_stringn, even when asked to construct the null string, in accordance with the R5RS. Previously, we optimized the null string case by returning a reference to a global null string object (scm_nullstr).
2012-01-10Merge commit 'f78a1ccede02ccad89d6c91a6b297f1f14a30907'Andy Wingo6-17/+53
2012-01-09Fix incorrect use of `SCM_UNPACK'.Ludovic Courtès1-4/+4
* libguile/arrays.c (scm_i_make_array): Cast the result of `scm_gc_malloc' directly to `scm_t_bits'.
2012-01-09i18n: Fix gc_malloc/free mismatch on non-GNU systems.Ludovic Courtès1-14/+8
* libguile/i18n.c (scm_i_locale_free): Remove. (smob_locale_free): Define only when USE_GNU_LOCALE_API. (scm_make_locale)[!USE_GNU_LOCALE_API]: Allocate `c_locale->locale_name' with `scm_gc_strdup', not `malloc'.
2012-01-09allocate a tc7 to bitvectorsAndy Wingo7-20/+27
* libguile/tags.h (scm_tc7_bitvector): Allocate a tc7 to bitvectors. * libguile/print.c (iprin1): * libguile/goops.c: * libguile/evalext.c (scm_self_evaluating_p): * libguile/eq.c (scm_equal_p): Add cases for bitvectors. * libguile/bitvectors.h: Declare internal print and equal? helpers. * libguile/bitvectors.c: Use a tc7 instead of a smob type.
2012-01-09allocate a tc7 to arraysAndy Wingo8-35/+41
* libguile/tags.h (scm_tc7_array): Allocate a tag for arrays. * libguile/arrays.h (SCM_I_ARRAYP): Change to use scm_tc7_array. The previous definition was not externally usable because scm_i_tc16_array was internal. (scm_i_print_array): Declare, though internally. * libguile/arrays.c (scm_i_make_array): Use scm_cell with the tc7 instead of NEWSMOB. (scm_i_print_array): Make not static. (SCM_ARRAY_IMPLEMENTATION): Adapt. (scm_init_arrays): Remove array smob declaration. * libguile/eq.c (scm_equal_p): Refactor to put the string, pointer, and bytevector cases in the switch. Add a case for arrays. * libguile/goops.c: Add <array> declarations. * libguile/print.c (iprin1): Call scm_i_print_array as needed. * libguile/evalext.c (scm_self_evaluating_p): Add a case for arrays.
2012-01-09primitive-load returns the value(s) of the last expressionAndy Wingo1-4/+8
* libguile/load.c (scm_primitive_load): Return the values yielded from evaluating the last expression in the file. * test-suite/tests/load.test ("return value of `load'"): Add tests.
2012-01-09Define _GNU_SOURCE to fix the GNU/kFreeBSD build.Rob Browning1-0/+1
Author: Petr Salinger <Petr.Salinger@seznam.cz> Closes: #401168
2012-01-09Fix the SRFI 60 copy-bit documentation.Rob Browning1-2/+2
2012-01-08Avoid calling scm_i_string_start_writing if no chars will be mutatedMark H Weaver1-75/+95
* libguile/srfi-13.c (scm_string_copy_x, scm_substring_fill_x, string_upcase_x, string_downcase_x, string_titlecase_x, string_reverse_x, scm_string_xcopy_x): Avoid calling `scm_i_string_start_writing' if the range of indices to be modified is empty. This avoids the error that would be raised by `scm_i_string_start_writing' if the string is not mutable. Thanks to Bruce Korb <bkorb@gnu.org> for reporting this problem and suggesting the fix.
2012-01-08allow scm_display_error to use a stack as the first argumentAndy Wingo1-0/+13
* libguile/backtrace.c (scm_display_error): Allow a deprecated use of this function to pass a stack as the first argument. Thanks to Peter Brett for pointing it out, in http://lists.gnu.org/archive/html/guile-user/2011-06/msg00000.html.
2012-01-08fix SCM_ASRTGO deprecationAndy Wingo2-6/+2
* libguile/__scm.h (SCM_ASRTGO): Whoops, actually remove the ASRTGO definitions here. * libguile/deprecated.h: Fix type of scm_i_deprecated_asrtgo.
2012-01-08deprecate SCM_ASRTGOAndy Wingo2-3/+23
* libguile/deprecated.h: Mark scm_immutable_cell and scm_immutable_double_cell as being SCM_DEPRECATED, not SCM_API. Deprecate SCM_ASRTGO. * libguile/deprecated.c (scm_i_deprecated_asrtgo): New support procedure. * doc/ref/api-control.texi (Handling Errors): Remove ASRTGO docs.
2012-01-07Fix bugs related to mutation-sharing substringsMark H Weaver1-0/+12
* libguile/strings.c (scm_i_is_narrow_string, scm_i_try_narrow_string, scm_i_string_set_x): Check to see if the provided string is a mutation-sharing substring, and do the right thing in that case. Previously, if such a string was passed to these functions, they would behave very badly: while trying to fetch and/or mutate the cell containing the stringbuf, they were actually fetching or mutating the cell containing the original shared string. That's because mutation-sharing substrings store the original string in CELL_1, whereas all other strings store the stringbuf there.
2012-01-07Make scm_nullstr mutableMark H Weaver1-2/+2
* libguile/strings.c (scm_init_strings): Make scm_nullstr mutable. It is still usable as a common object, because of course it contains no characters to mutate anyway. It is returned by several procedures that are specified to return mutable strings, and string mutators raise errors when passed an immutable string, even if it is the null string.
2012-01-07don't leak file descriptors when mmaping objcodeAndy Wingo1-4/+3
* libguile/objcodes.c (make_objcode_from_file): Close the mmap'd file, so that we don't leak the descriptor. I was previously under the mistaken impression that closing the fd unmapped the memory, which is not the case. Thanks to Cedric Cellier for the tip!
2012-01-05Placate a number of `syntax-check' verifications.Ludovic Courtès3-4/+7
- "filesystem" -> "file system" - remove doubled words - use EXIT_* macros instead of literal numbers - update `syntax-check' exclusion files
2012-01-05Fix erroneous check in `set-procedure-properties!'.Ludovic Courtès1-3/+4
* libguile/procprop.c (scm_set_procedure_properties_x)[SCM_ENABLE_DEPRECATED == 1]: Pass arguments to `scm_assq' in the right order, and check its return value with `scm_is_true'. Reported by Mike Gran <spk121@yahoo.com>.
2011-12-22fix generalized-vector-{ref,set!} for slicesAndy Wingo1-2/+6
* libguile/generalized-vectors.c (scm_c_generalized_vector_ref): (scm_c_generalized_vector_set_x): Fix for the case in which base was not 1, lbnd was not 0, or inc was not 1. * test-suite/tests/arrays.test (array): Add a test. Thanks to Daniel Llorens for the report.
2011-12-22freebsd itanium supportAndy Wingo1-0/+15
* libguile/threads.c (scm_ia64_register_backing_store_base) (scm_ia64_ar_bsp): Provide implementation of these itanium helpers on freebsd. Thanks to Jim Pryor.
2011-12-22freebsd implementation of get_thread_stack_baseAndy Wingo1-0/+27
* configure.ac: Check for pthread_np.h and pthread_attr_get_np. Patch by Jim Pryor. * libguile/threads.c (get_thread_stack_base): Provide an implementation for FreeBSD.
2011-12-22stdlib.h, not malloc.hAndy Wingo4-15/+5
* configure.ac: Remove check for malloc.h. * libguile/gc-malloc.c: * libguile/gc.c: * libguile/mallocs.c: * libguile/smob.c: Use stdlib instead of malloc.h.
2011-12-19Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo7-36/+101
Conflicts: libguile/feature.c m4/gnulib-cache.m4 module/ice-9/deprecated.scm module/language/tree-il/peval.scm
2011-12-19fix scm_protects deprecation warningAndy Wingo1-0/+2
* libguile/gc.c: Fix warning about scm_protects being deprecated.
2011-12-19FFI: Properly unpack small integer return values in closure call.Andreas Schwab1-9/+31
Fixes <http://debbugs.gnu.org/10203>. * libguile/foreign.c (unpack): Add parameter return_value_p. Properly store integer return values smaller than int. (scm_i_foreign_call): Update call to unpack. (invoke_closure): Likewise.
2011-12-15Arrange to convert command-line arguments from the right encoding.Ludovic Courtès5-11/+54
This is a temporary workaround for the 2.0 stable series. The next stable series should have an implicit `setlocale (LC_ALL, "")' call, which will make this unnecessary. * libguile/feature.c (progargs_fluid): Rename to... (scm_program_arguments_fluid): ... this. Update users. * libguile/feature.h (scm_program_arguments_fluid): New internal declaration. * libguile/init.c (invoke_main_func): Call `scm_i_set_boot_program_arguments' instead of `scm_set_program_arguments'. * libguile/script.c (locale_arguments_to_string_list, scm_i_set_boot_program_arguments): New functions. (scm_compile_shell_switches): Use `locale_arguments_to_string_list'. * libguile/script.h (scm_i_set_boot_program_arguments): New internal declaration. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add `test-command-line-encoding'. * test-suite/standalone/test-command-line-encoding: New file.
2011-12-14Use `alignof_type' instead of `alignof'.Ludovic Courtès2-16/+16
* libguile/foreign.c: Use `alignof_type' instead of `alignof'; the latter was removed from Gnulib's <alignof.h> in 408e170e3ae81f73fb65686c5834693d89a96594 (Nov. 1 2011). * libguile/vm-i-scheme.c: Likewise.
2011-12-13Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo3-0/+13
Conflicts: configure.ac
2011-12-10current-input-port et al are srfi-39 parametersAndy Wingo1-0/+5
* libguile/ports.c (scm_init_ports): Export the port fluids to Scheme, temporarily. * module/ice-9/boot-9.scm (fluid->parameter): Turn `current-input-port' et al into srfi-39 parameters, backed by the exported fluids, then remove the fluids from the guile module. (%cond-expand-features): Add srfi-39. * module/srfi/srfi-39.scm: Re-export features from boot-9. * test-suite/tests/parameters.test: Add tests.
2011-12-08fix compilation with gc 7.1Chris K. Jester-Young2-0/+8
* configure.ac: Add checks for GC_gcollect_and_unmap and GC_get_unmapped_bytes. * libguile/gc-malloc.c (scm_realloc): GC_gcollect() if we don't have GC_gcollect_and_unmap. * libguile/gc.c (GC_get_heap_usage_safe): Likewise, don't GC_get_unmapped_bytes if the function doesn't exist.
2011-12-06Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo9-24/+66
Conflicts: libguile/deprecation.c libguile/load.c libguile/print.c
2011-12-06enable port lockingAndy Wingo1-3/+0
* libguile/ports.c (scm_c_make_port_with_encoding): Enable port locking.
2011-12-06fix scm_adjust_port_revealed_x FUNC_NAMEAndy Wingo1-1/+1
* libguile/ports.c (scm_adjust_port_revealed_x): Fix FUNC_NAME.