summaryrefslogtreecommitdiff
path: root/libguile/init.c
Commit message (Collapse)AuthorAgeFilesLines
* Refactor handling of auxiliary stacks and setjmp/longjmpAndy Wingo2018-06-171-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/__scm.h (scm_i_jmp_buf): Remove definition, which was a shim for ia64. Instead, always use setjmp/longjmp and jmp_buf. * libguile/_scm.h (SCM_I_SETJMP, SCM_I_LONGJMP): Remove; instead use setjmp and longjmp. * libguile/continuations.c (capture_auxiliary_stack): (restore_auxiliary_stack): New helpers. (scm_i_make_continuation): Use capture_auxiliary_stack. (copy_stack_and_call): Use restore_auxiliary_stack. No need to stash the aux stack on the thread, either. * libguile/continuations.h (scm_t_contregs): Use SCM_HAVE_AUXILIARY_STACK to flag when to have an auxiliary_stack member. * libguile/control.h: * libguile/control.c (reify_partial_continuation, scm_c_abort): (scm_suspendable_continuation_p): Adapt to use setjmp/longjmp directly. * libguile/deprecated.h: Add deprecated scm_i_jmp_buf define. * libguile/dynstack.h: * libguile/dynstack.c (PROMPT_JMPBUF): (scm_dynstack_push_prompt, scm_dynstack_find_prompt): (scm_dynstack_wind_prompt): Adapt to jmp_buf type. * libguile/eval.c (eval): Use jmp_buf and setjmp directly. * libguile/gc-malloc.c: No need for ia64-specific things. * libguile/gc.c: No need for ia64-specific things. * libguile/gc.h: No need to declare scm_ia64_ar_bsp. * libguile/init.c: Remove typedef of setjmp_type for Cray, unused. * libguile/threads.c (guilify_self_1): No more pending_rbs_continuation in scm_i_thread, and register_backing_store_base is handled by libgc. (scm_ia64_ar_bsp): Remove definitions; inlined into continuations.c's capture_auxiliary_stack. * libguile/threads.h (scm_i_thread): jmpbuf member is plain jmp_buf. * libguile/throw.c (catch): Just use jmp_buf and setjmp. * libguile/vm-engine.c (VM_NAME): Adapt prototype to take jmp_buf pointer. * libguile/vm.c (vm_abort): Adapt jmp_buf types. (scm_call_n): Use setjmp.
* Fix libguile subcomponent headers not to include <libguile.h>Andy Wingo2018-06-141-0/+5
| | | | | | | | | | | | | | | | | | | * libguile/bytevectors.h: Include uniform.h, for use in the macros. * libguile/extensions.h: Include libpath.h, for the SCM_EFFECTIVE_VERSION, which is almost always used with these routines. * libguile/frames.h: * libguile/instructions.h: * libguile/intrinsics.h: * libguile/loader.h: * libguile/programs.h: * libguile/vm.h: Include <libguile/__scm.h> instead of <libguile.h>. Cuts a circular include, but also precipitates a lot of maintenance in the .c files. * libguile/*.c: Update C files to add needed all needed includes that before were getting automatically pulled in by the indirect inclusion of libguile.h.
* Add instrinsics to runtimeAndy Wingo2018-03-301-1/+3
| | | | | | | * libguile/intrinsics.c: * libguile/intrinsics.h: New files. * libguile/Makefile.am: * libguile/init.c: Add new files to build.
* Add disjoint syntax object typeAndy Wingo2017-03-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES, DOT_DOC_FILES, noinst_HEADERS): Add syntax.c and syntax.h. * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (class_syntax, scm_class_of, scm_goops_early_init): * libguile/init.c (scm_init_guile): * libguile/print.c (iprin1): * libguile/tags.h (scm_tc7_syntax): * module/oop/goops.scm (<syntax>): * module/system/base/types.scm (%tc7-syntax, cell->object): * module/system/vm/disassembler.scm (code-annotation): Wire up the new data type. * libguile/syntax.c: * libguile/syntax.h: New files. * module/ice-9/boot-9.scm: Move new definitions to (system syntax internal). * module/system/syntax.scm (print-syntax): New helper. * module/system/vm/assembler.scm (statically-allocatable?) (intern-constant, link-data): Arrange to be able to write syntax objects into images. * module/language/cps/types.scm (&syntax): New type. Remove &hash-table; it was never detected, an internal binding, and we need the bit to avoid going into bignum territory.
* Fix segfault introduced with R6RS port commitAndy Wingo2017-02-281-1/+1
| | | | | | | * libguile/init.c (scm_i_init_guile): Move scm_register_r6rs_ports later, so that defining port types hsa the SCM trampoline subrs defined. * libguile/bytevectors.c (scm_bootstrap_bytevectors): Cosmetic changes.
* Deprecate dynamic rootsAndy Wingo2016-11-211-1/+0
| | | | | | | | | | | | | * libguile/root.h: * libguile/root.c: Remove these files. * libguile/deprecated.h: * libguile/deprecated.c (scm_internal_cwdr, scm_call_with_dynamic_root) (scm_dynamic_root, scm_apply_with_dynamic_root): Deprecate. Remove all root.h usage, which was vestigial. * module/ice-9/serialize.scm: Use (current-thread) instead of (dynamic-root).
* Use atomics for async interruptsAndy Wingo2016-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/__scm.h (SCM_TICK): Always define as scm_async_tick(). * libguile/error.c (scm_syserror, scm_syserror_msg): * libguile/fports.c (fport_read, fport_write): * libguile/_scm.h (SCM_SYSCALL): Replace SCM_ASYNC_TICK with scm_async_tick (). (SCM_ASYNC_TICK, SCM_ASYNC_TICK_WITH_CODE) (SCM_ASYNC_TICK_WITH_GUARD_CODE): Remove internal definitions. We inline into vm-engine.c, the only place where it matters. * libguile/async.h: * libguile/async.c (scm_async_tick, scm_i_setup_sleep): (scm_i_reset_sleep, scm_system_async_mark_for_thread): * libguile/threads.h (struct scm_thread_wake_data): * libguile/threads.h (scm_i_thread): * libguile/threads.c (block_self, guilify_self_1, scm_std_select): Rewrite to use sequentially-consistent atomic references. * libguile/atomics-internal.h (scm_atomic_set_pointer): (scm_atomic_ref_pointer): New definitions. * libguile/finalizers.c (queue_finalizer_async): We can allocate, so just use scm_system_async_mark_for_thread instead of the set-cdr! shenanigans. * libguile/scmsigs.c (take_signal): * libguile/gc.c (queue_after_gc_hook): Adapt to new asyncs mechanism. Can't allocate but we're just manipulating the current thread when no other threads are running so we should be good. * libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Inline the async_tick business.
* Move thread bindings to (ice-9 threads)Andy Wingo2016-10-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/init.c (scm_i_init_guile): Don't call scm_init_thread_procs. * libguile/threads.c (scm_init_ice_9_threads): Rename from scm_init_thread_procs, make static. (scm_init_threads): Register scm_init_thread_procs extension. * libguile/threads.h (scm_init_thread_procs): Remove decl. * module/ice-9/boot-9.scm: Load (ice-9 threads), so that related side effects occur early. * module/ice-9/deprecated.scm (define-deprecated): Fix to allow deprecated bindings to appear in operator position. Export deprecated bindings. (define-deprecated/threads, define-deprecated/threads*): Trampoline thread bindings to (ice-9 threads). * module/ice-9/futures.scm: Use ice-9 threads. * module/ice-9/threads.scm: Load scm_init_ice_9_threads extension. Reorder definitions and imports so that the module circularity with (ice-9 futures) continues to work. * module/language/cps/intmap.scm: * module/language/cps/intset.scm: * module/language/tree-il/primitives.scm: Use (ice-9 threads). * module/language/cps/reify-primitives.scm: Reify current-thread in (ice-9 threads) module. * module/srfi/srfi-18.scm: Use ice-9 threads with a module prefix, and adapt all users. Use proper keywords in module definition form. * test-suite/tests/filesys.test (test-suite): * test-suite/tests/fluids.test (test-suite): * test-suite/tests/srfi-18.test: Use ice-9 threads. * NEWS: Add entry. * doc/ref/api-scheduling.texi (Threads): Update. * doc/ref/posix.texi (Processes): Move current-processor-count and total-processor-count docs to Threads.
* Deprecate arbitersAndy Wingo2016-10-171-2/+0
| | | | | | | | | | | | | | | * libguile/arbiters.c: * libguile/arbiters.h: * test-suite/tests/arbiters.test: Delete files. * libguile/deprecated.c: * libguile/deprecated.h: Move arbiters code here. * doc/ref/api-scheduling.texi: Remove section on arbiters. * libguile.h: * libguile/Makefile.am: * libguile/init.c: * module/oop/goops.scm: * test-suite/Makefile.am: Remove mention of arbiters. * NEWS: Update.
* Add atomic boxesAndy Wingo2016-09-061-0/+2
| | | | | | | | | | | | | | | | | | | | | * doc/ref/api-scheduling.texi (Atomics): New manual section. * libguile.h: Include atomic.h. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Add atomic. * libguile/atomic.c: * libguile/atomic.h: New files. * libguile/atomics-internal.h (scm_atomic_set_scm, scm_atomic_ref_scm) (scm_atomic_swap_scm, scm_atomic_compare_and_swap_scm): New facilities. * libguile/goops.c (class_atomic_box, scm_sys_goops_early_init): Add support for <atomic-box>. Remove duplicate <keyword> fetch. * libguile/init.c (scm_i_init_guile): Call scm_register_atomic_box. * libguile/print.c (iprin1): Add atomic box case. * libguile/tags.h (scm_tc7_atomic_box): New tag. * libguile/validate.h (SCM_VALIDATE_ATOMIC_BOX): New macro. * module/Makefile.am (SOURCES): Add ice-9/atomic.scm. * module/ice-9/atomic.scm: New file. * module/oop/goops.scm (<atomic-box>): New var.
* Add file descriptor finalizersAndy Wingo2016-08-301-0/+2
| | | | | | | | | | | | | | | | | | * doc/ref/posix.texi (Ports and File Descriptors): Document new interfaces. * libguile/filesys.c (scm_close, scm_close_fdes) * libguile/fports.c (fport_close): * libguile/ioext.c (scm_primitive_move_to_fdes): Call scm_run_fdes_finalizers. * module/ice-9/fdes-finalizers.scm: * test-suite/tests/fdes-finalizers.test: * libguile/fdes-finalizers.h: * libguile/fdes-finalizers.c: New files. * module/Makefile.am: * test-suite/Makefile.am: * libguile/Makefile.am: * libguile.h: * libguile/init.c: Wire up new files.
* Tweak port initialization orderAndy Wingo2016-04-301-1/+1
| | | | | | * libguile/init.c (scm_i_init_guile): Initialize ports before strports/fports, so that we have initialized the read/write trampolines before making port types.
* Merge commit 'a7bbba05838cabe2294f498e7008e1c51db6d664'Andy Wingo2015-01-221-4/+4
|\
| * scm_boot_guile: Gracefully handle the case where argc == 0.Mark H Weaver2014-10-101-4/+4
| | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'stable-2.0'Mark H Weaver2014-09-301-0/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Add (ice-9 unicode) moduleAndy Wingo2014-09-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
| * Fix problems with Windows file names that use backslashes.Eli Zaretskii2014-07-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/load.c (scm_i_mirror_backslashes): New function. (scm_init_load_path): Call it to produce MS-Windows file names with forward slashes. (FILE_NAME_SEPARATOR_STRING): Define as "/" on all platforms. * libguile/load.h (scm_i_mirror_backslashes): Add prototype. * libguile/init.c (scm_boot_guile): Call scm_i_mirror_backslashes on argv[0]. * libguile/filesys.c (scm_getcwd): Call scm_i_mirror_backslashes on the directory name returned by getcwd. * test-suite/tests/ports.test ("file name separators"): New test.
* | Add (ice-9 unicode) moduleAndy Wingo2014-09-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2014-04-281-0/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .gitignore doc/example-smob/Makefile doc/ref/api-smobs.texi doc/ref/libguile-concepts.texi doc/ref/libguile-smobs.texi libguile.h libguile/finalizers.c libguile/finalizers.h libguile/goops.c module/language/tree-il/compile-glil.scm module/oop/goops.scm
| * New foreign object facility, to replace SMOBsAndy Wingo2014-04-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/foreign-object.c: * libguile/foreign-object.h: * module/system/foreign-object.scm: * test-suite/standalone/test-foreign-object-c.c: * test-suite/standalone/test-foreign-object-scm: New files. * test-suite/standalone/Makefile.am: * module/Makefile.am: * libguile/Makefile.am: Add new files. * libguile.h: Add foreign-object.h. * libguile/init.c (scm_i_init_guile): Call scm_register_foreign_object.
* | Merge branch 'stable-2.0'v2.1.0Mark H Weaver2014-04-251-3/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: GUILE-VERSION NEWS guile-readline/ice-9/readline.scm libguile/async.c libguile/backtrace.c libguile/deprecated.h libguile/gc-malloc.c libguile/gdbint.c libguile/init.c libguile/ioext.c libguile/mallocs.c libguile/print.c libguile/rw.c libguile/scmsigs.c libguile/script.c libguile/simpos.c libguile/snarf.h libguile/strports.c libguile/threads.c libguile/vm-i-scheme.c libguile/vm-i-system.c module/srfi/srfi-18.scm test-suite/Makefile.am test-suite/standalone/test-num2integral.c
| * Rely on Gnulib for <unistd.h>.Mark H Weaver2014-02-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/async.c: * libguile/backtrace.c: * libguile/error.c: * libguile/filesys.c: * libguile/fports.c: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/gdbint.c: * libguile/init.c: * libguile/ioext.c: * libguile/load.c: * libguile/mallocs.c: * libguile/mkstemp.c: * libguile/ports.c: * libguile/posix.c: * libguile/r6rs-ports.c: * libguile/random.c: * libguile/rw.c: * libguile/scmsigs.c: * libguile/script.c: * libguile/simpos.c: * libguile/socket.c: * libguile/stime.c: * libguile/strports.c: * libguile/threads.c: Unconditionally include <unistd.h>.
* | Define a C fluid for current-warning-portAndy Wingo2014-03-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/ports.c (scm_current_input_port, scm_current_output_port) (scm_current_error_port): Fix declarations to C99. (scm_current_warning_port, scm_set_current_warning_port): Rework to use a C fluid, like scm_current_error_port. (scm_init_ports): Initialize and define the warning port fluid. * libguile/init.c (scm_init_standard_ports): Init the current warning port. * module/ice-9/boot-9.scm: Remove definitions for current-warning-port. Instead, steal it from the boot objtable with port-parameterize!.
* | Remove nonfunctional gdb interfaceAndy Wingo2013-11-271-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | * libguile/gdb_interface.h: * libguile/gdbint.c: * libguile/gdbint.h: Remove. These were last modified significantly in 1997 and I think they are unused. * libguile/guile.c: Remove use. * libguile.h: Remove inclusion. * libguile/Makefile.am: Remove reference. * libguile/init.c: Remove use.
* | Rename objcodes?.{scm,c,h} to loader.{scm,c,h}Andy Wingo2013-11-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/loader.c: * libguile/loader.h: Rename from objcodes.[ch]. * module/system/vm/loader.scm: Rename from objcode.scm. * libguile/Makefile.am: * libguile/gsubr.c: * libguile/init.c: * libguile/procs.c: * libguile/vm.c: * module/Makefile.am: * module/ice-9/eval-string.scm: * module/language/rtl/spec.scm: * module/system/base/target.scm: * module/system/repl/command.scm: * module/system/repl/common.scm: * module/system/vm/debug.scm: * module/system/vm/disassembler.scm: * module/system/vm/objcode.scm: * test-suite/tests/compiler.test: * test-suite/tests/dwarf.test: * test-suite/tests/rtl-compilation.test: * test-suite/tests/rtl.test: Adapt.
* | Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2013-04-141-0/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: GUILE-VERSION libguile/array-map.c libguile/fports.h libguile/gc.h libguile/inline.h libguile/ports.c libguile/ports.h libguile/print.c libguile/r6rs-ports.c libguile/read.c test-suite/tests/00-socket.test
| * Add keyword arguments to file opening procedures.Mark H Weaver2013-04-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/fports.c (scm_open_file_with_encoding): New API function, containing the code previously found in 'scm_open_file', but modified to accept the new 'guess_encoding' and 'encoding' arguments. (scm_open_file): Now just a simple wrapper that calls 'scm_open_file_with_encoding'. (scm_i_open_file): New implementation of 'open-file' that accepts keyword arguments '#:guess-encoding' and '#:encoding', and calls 'scm_open_file_with_encoding'. (scm_init_fports_keywords): New initialization function that gets called after keywords are initialized. * libguile/fports.h (scm_open_file_with_encoding, scm_init_fports_keywords): Add prototypes. * libguile/init.c (scm_i_init_guile): Call 'scm_init_fports_keywords'. * module/ice-9/boot-9.scm: Add enhanced versions of 'open-input-file', 'open-output-file', 'call-with-input-file', 'call-with-output-file', 'with-input-from-file', 'with-output-to-file', and 'with-error-to-file', that accept keyword arguments '#:binary', '#:encoding', and (for input port constructors) '#:guess-encoding'. * doc/ref/api-io.texi (File Ports): Update documentation. * test-suite/tests/ports.test ("keyword arguments for file openers"): Add tests.
* | Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2013-03-281-2/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.ac libguile/deprecated.c libguile/deprecated.h libguile/filesys.h libguile/fluids.c libguile/fports.c libguile/gc.c libguile/guile.c libguile/numbers.c libguile/objcodes.c libguile/r6rs-ports.c libguile/smob.c libguile/socket.c libguile/threads.h module/language/scheme/decompile-tree-il.scm module/language/tree-il/peval.scm test-suite/tests/syncase.test
| * remove init.c iselect includeAndy Wingo2013-03-091-2/+1
| | | | | | | | * libguile/init.c: Remove iselect include.
* | Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo2012-03-081-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.ac libguile/finalizers.c libguile/finalizers.h libguile/gc.c libguile/gc.h libguile/inline.c libguile/inline.h libguile/ports.c libguile/smob.c libguile/smob.h module/ice-9/deprecated.scm module/ice-9/r4rs.scm
| * run finalizers asynchronously in asyncsAndy Wingo2012-03-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/finalizers.c: New excitement! We'll be running finalizers asynchronously, from asyncs. This will make it safer to allocate while holding a mutex. (GC_set_finalizer_notifier): Add back-compat shim. * libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism during boot. * libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing on demand. (scm_gc): Explicitly run finalizers here. * libguile/threads.c (guilify_self_2): Run finalizers here if queue_finalizer_async happened to run during guilify_self_1. * configure.ac: Add check for GC_set_finalizer_notifier.
| * Fix a segfault when /dev/urandom is not accessibleGiuseppe Scrivano2012-03-071-2/+2
| | | | | | | | | | * libguile/init.c (scm_i_init_guile): Call `scm_init_random' before `scm_init_macros'.
* | run finalizers asynchronously (in asyncs and/or pthreads)Andy Wingo2012-02-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/finalizers.c: New excitement! We'll be running finalizers in threads, if that's available. If it's not available, during early boot, we can run finalizers in asyncs. This will make it safer to allocate while holding a mutex. * libguile/posix.c (scm_fork): Shut down the finalizer thread before forking. * libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism during boot and, if available, initialialize the finalizer thread at the very end. * libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing on demand. (scm_gc): Explicitly run finalizers here. If you're calling this function, you probably want synchronous GC.
* | Revert "with a threaded guile, lock weak sets and tables during a fork"Andy Wingo2012-02-231-1/+0
| | | | | | | | This reverts commit f609480611cfd1585409fd6b1b90beb730b026cf.
* | move revealed-count mechanism to fports.cAndy Wingo2012-02-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/fports.c (scm_revealed_count, scm_port_revealed) (scm_set_port_revealed_x, scm_adjust_port_revealed_x): Move these APIs here, and only operate on fports. To keep revealed ports alive, now we will just keep them in a data structure that the GC knows about -- a static list. * libguile/fports.h: Add revealed count to scm_t_fport, and move decls of revealed-count functions here. * libguile/ports.h: * libguile/ports.c: Adapt to change. Remove SCM_REVEALED and SCM_SETREVEALED; since they only apply to fports now, keeping them around would be inviting type errors. (finalize_port): We don't need to worry about resuscitating ports here. * libguile/init.c: Use the scm_set_port_revealed_x function to set the revealed counts on stream ports.
* | with a threaded guile, lock weak sets and tables during a forkAndy Wingo2012-02-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | * libguile/weak-set.c (make_weak_set): * libguile/weak-table.c (make_weak_table): If we have a threaded Guile, * keep a weak set (table) of weak sets (tables). Use this and the pthread_atfork mechanism to lock and unlock weak sets and weak tables during a fork(). * libguile/weak-set.h (scm_weak_set_prehistory): New internal API. * libguile/init.c: Add call to scm_weak_set_prehistory().
* | Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2012-02-081-4/+5
|\ \ | |/ | | | | | | | | | | Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c
| * Use Gnulib's `regex' module.Ludovic Courtès2012-02-031-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should help with regex portability, as reported in <http://bugs.gnu.org/10684> for Darwin 8.11. * m4/gnulib-cache.m4 (gl_MODULES): Add `regex'. * configure.ac: Remove header checks for regex.h, rxposix.h, and rx/rxposix.h. Remove check for the `regcomp' function. Remove definition of `HAVE_REGCOMP'. Define `ENABLE_REGEX'. * libguile/init.c: Check for `ENABLE_REGEX' instead of `HAVE_REGCOMP'. * libguile/regex-posix.c: Always include <regex.h>. Remove #ifdefs for rxposix.h and co.
* | Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2011-12-191-1/+1
|\ \ | |/ | | | | | | | | | | | | Conflicts: libguile/feature.c m4/gnulib-cache.m4 module/ice-9/deprecated.scm module/language/tree-il/peval.scm
| * Arrange to convert command-line arguments from the right encoding.Ludovic Courtès2011-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2011-10-271-2/+2
|\ \ | |/ | | | | | | | | | | | | Conflicts: GUILE-VERSION libguile/deprecated.c libguile/gc-malloc.c module/language/tree-il/peval.scm
| * Initialize `get_internal_run_time' before it is used.Ludovic Courtès2011-10-221-2/+2
| | | | | | | | | | | | * libguile/init.c (scm_i_init_guile): Call `scm_init_stime' before `scm_init_gc'. Fixes <https://savannah.gnu.org/bugs/?34616> reported by Bake Timmons.
* | remove weak pairs, rewrite weak vectorsAndy Wingo2011-10-241-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/weak-vector.c: * libguile/weak-vector.h: Renamed from weaks.[ch]. Remove weak pairs. They were not safe to access with `car' and `cdr'. Remove weak alist vectors, as we have weak tables and sets. Reimplement weak vectors, moving the implementation here. * libguile/vectors.c: * libguile/vectors.h: Remove the extra header word. Use scm_c_weak_vector_ref / scm_c_weak_vector_set_x to access weak vectors. * libguile/snarf.h: Remove the extra header word in vectors. * libguile/threads.c (do_thread_exit, fat_mutex_lock, fat_mutex_unlock): Instead of weak pairs, store thread-owned mutexes in a list of one-element weak vectors. * libguile/guardians.c (finalize_guarded): Similarly, store object guardians in a list of one-element weak vectors. * libguile/modules.c (scm_module_reverse_lookup): We no longer need to handle the case of weak references. * libguile/print.c (iprin1): Use the standard vector accessor to print vectors. * libguile.h: * libguile/Makefile.am: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/goops.c: * libguile/init.c: * libguile/objprop.c: * libguile/struct.c: Update includes. * module/ice-9/weak-vector.scm: Load weak vector definitions using an extension instead of %init-weaks-builtins. * test-suite/tests/weaks.test: Use the make-...-hash-table names instead of the old alist vector names.
* | add weak table implementationAndy Wingo2011-10-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/weak-table.c: * libguile/weak-table.h: New files, implementing open-addressed weak hash tables, similar to the implementation of weak sets. This will let us remove weak pairs. * libguile.h: * libguile/Makefile.am: * libguile/evalext.c: * libguile/gc.c: * libguile/init.c: * libguile/print.c: * libguile/tags.h: Update all the pieces for the new files and tc7.
* | add weak setsAndy Wingo2011-10-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/weak-set.c: * libguile/weak-set.h: New files, implementing weak sets, for use in the symbol table and port set. Eventually we will be able to remove weak pairs. * libguile.h: * libguile/Makefile.am: Add new files. * libguile/evalext.c: * libguile/gc.c: * libguile/init.c: * libguile/print.c: * libguile/tags.h: Add support for the new types.
* | Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo2011-06-301-0/+2
|\ \ | |/ | | | | | | | | Conflicts: libguile/deprecated.c module/ice-9/psyntax-pp.scm
| * fix --disable-modules buildAndy Wingo2011-06-301-0/+2
| | | | | | | | | | | | | | | | | | * configure.ac (HAVE_MODULES): Define HAVE_MODULES iff --enable-modules. * libguile/deprecated.c (scm_dynamic_args_call) * libguile/extensions.c (load_extension): * libguile/init.c (scm_i_init_guile): Use HAVE_MODULES in a few places.
* | remove #define STACK_CHECKING from __scm.h.Andy Wingo2011-05-151-2/+0
|/ | | | | | | | | | * libguile/__scm.h: Remove #define STACK_CHECKING and #undef NO_CEVAL_STACK_CHECKING. * libguile/debug.c (scm_debug_options) * libguile/init.c (scm_i_init_guile): * libguile/stackchk.c (scm_report_stack_overflow): * libguile/stackchk.h: Always enable stack checking.
* Make the `sizeof (mpz_t)' check at compile-time.Ludovic Courtès2011-04-251-7/+0
| | | | | | | * libguile/init.c (scm_i_init_guile): Remove the `sizeof (mpz_t)' run-time check. * libguile/numbers.c: Add a compile-time check for `sizeof (mpz_t)'.
* Allow compilation with `--disable-posix'.Ludovic Courtès2011-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Dmitry Dzhus <dima@dzhus.org>. * configure.ac: Remove `AC_LIBOBJ([filesys])'. Document `--disable-posix' as omitting non-essential POSIX interfaces. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Add `filesys.c'. (DOT_DOC_FILES): Add `filesys.doc'. (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Remove `filesys.c'. * libguile/posix.c (scm_mkstemp, scm_access): Move to `filesys.c'. (scm_init_posix): Move `R_OK' etc. to `filesys.c'. * libguile/filesys.c (scm_chown, scm_chmod, scm_umask, scm_open_fdes, scm_open, scm_close, scm_close_fdes, scm_link, scm_tc16_dir, scm_directory_stream_p, scm_opendir, scm_readdir, scm_rewinddir, scm_closedir, scm_dir_print, scm_dir_free, scm_chdir, scm_getcwd, set_element, fill_select_type, get_element, retrieve_select_type, scm_select, scm_fcntl, scm_fsync, scm_symlink, scm_readlink, scm_lstat, scm_copy_file): Conditionalize on HAVE_POSIX. (scm_mkstemp, scm_access): New functions. (scm_init_filesys): Conditionalize `scm_tc16_dir', `O_RDONLY', etc. on HAVE_POSIX. Define `R_OK', `W_OK', etc. * libguile/fports.c (fport_print): Use `scm_ttyname' only when HAVE_POSIX. * libguile/i18n.c (lock_locale_mutex, unlock_locale_mutex): New functions. Update users of `scm_i_locale_mutex' to use them. * libguile/init.c (scm_i_init_guile): Always call `scm_init_filesys'. * meta/guile-tools.in (main): Use `setlocale' only when it is defined. * module/ice-9/boot-9.scm: Always load `ice-9/posix'.