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

114 commits

Author SHA1 Message Date
Andy Wingo
fe4a34d20d Deprecate make-struct
* libguile/struct.c: Replace uses of scm_make_struct with
  scm_make_struct_no_tail or scm_c_make_struct.
  (scm_make_struct_no_tail): Move this function to C instead of Scheme
  to be able to deprecate scm_make_struct.
* libguile/struct.h (scm_make_struct_no_tail): New public declaration.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_make_struct): Deprecate.
* libguile/print.c:
* libguile/procs.c:
* libguile/stacks.c: Replace uses of scm_make_struct with
  scm_make_struct_no_tail.
* test-suite/tests/coverage.test:
* test-suite/tests/structs.test: Use make-struct/no-tail instead of
  make-struct.
* NEWS: Add entry.
2017-09-22 10:32:33 +02:00
Andy Wingo
69ca2bb221 Elide syscalls in fdes->port
* libguile/fports.h (scm_t_fport): Add options field.
  (SCM_FDES_RANDOM_P): Deprecate.
  (scm_i_fdes_to_port): Add options argument.
* libguile/fports.c (scm_i_fdes_to_port): Add options argument.  Only
  verify FD if SCM_FPORT_OPTION_VERIFY is there.
  (scm_fdes_to_port, scm_open_file_with_encoding): Adapt to
  scm_i_fdes_to_port changes.
  (fport_random_access_p): Don't try to seek if NOT_SEEKABLE option is
  set.
* libguile/deprecated.h:
* libguile/deprecated.c (SCM_FDES_RANDOM_P): Deprecate.
* NEWS: Add deprecation.
* libguile/filesys.c:
* libguile/ioext.c:
* libguile/posix.c:
* libguile/read.c:
* libguile/socket.c: Adapt callers.
2017-02-14 22:03:21 +01:00
Andy Wingo
aa84489d18 Reimplement dynamic states
There are two goals: one, to use less memory per dynamic state in order
to allow millions of dynamic states to be allocated in light-weight
threading scenarios.  The second goal is to prevent dynamic states from
being actively mutated in two threads at once.  This second goal does
mean that dynamic states object that escape into scheme are now copies
that won't receive further updates; an incompatible change, but one
which we hope doesn't affect anyone.

* libguile/cache-internal.h: New file.
* libguile/fluids.c (is_dynamic_state, get_dynamic_state)
  (save_dynamic_state, restore_dynamic_state, add_entry)
  (copy_value_table): New functions.
  (scm_i_fluid_print, scm_i_dynamic_state_print): Move up.
  (new_fluid): No need for a number.
  (scm_fluid_p: scm_is_fluid): Inline IS_FLUID uses.
  (fluid_set_x, fluid_ref): Adapt to dynamic state changes.
  (scm_fluid_set_x, scm_fluid_unset_x): Call fluid_set_x.
  (scm_swap_fluid): Rewrite in terms of fluid_ref and fluid_set.
  (swap_fluid): Use internal fluid_set_x.
  (scm_i_make_initial_dynamic_state): Adapt to dynamic state
  representation change.
  (scm_dynamic_state_p, scm_is_dynamic_state): Use new accessors.
  (scm_current_dynamic_state): Use make_dynamic_state.
  (scm_dynwind_current_dynamic_state): Use new accessor.
* libguile/fluids.h: Remove internal definitions.  Add new struct
  definition.
* libguile/threads.h (scm_i_thread): Use scm_t_dynamic_state for dynamic
  state.
* libguile/threads.c (guilify_self_1, guilify_self_2):
  (scm_i_init_thread_for_guile, scm_init_guile):
  (scm_call_with_new_thread):
  (scm_init_threads, scm_init_threads_default_dynamic_state): Adapt to
  scm_i_thread change.
  (scm_i_with_guile, with_guile): Remove "and parent" suffix.
  (scm_i_reset_fluid): Remove unneeded function.
* doc/ref/api-scheduling.texi (Fluids and Dynamic States): Remove
  scm_make_dynamic_state docs.  Update current-dynamic-state docs.
* libguile/vm-engine.c (vm_engine): Update fluid-ref and fluid-set!
  inlined fast paths for dynamic state changes.
* libguile/vm.c (vm_error_unbound_fluid): Remove now-unused function.
* NEWS: Update.
* module/ice-9/deprecated.scm (make-dynamic-state): New definition.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_make_dynamic_state): Move here.
* libguile/__scm.h (scm_t_dynamic_state): New typedef.
* libguile/dynstack.h:
* libguile/dynstack.c (scm_dynstack_push_fluid):
  (scm_dynstack_unwind_fluid): Take raw dynstate in these internal
  functions.
* libguile/throw.c (catch): Adapt to dynstack changes.
2016-12-05 21:46:37 +01:00
Daniel Llorens
fa4a22971a Deprecate scm_from_contiguous_array
scm_from_contiguous_array() was undocumented, unused within Guile, and
can be replaced by make-array + array-copy! without requiring contiguity
and without loss of performance.

* libguile/arrays.c (scm_array_contents): Do not rely on
  SCM_I_ARRAY_CONTP.
* test-suite/tests/arrays.test: Test array-contents with 0-rank array.
* libguile/arrays.h: Declare scm_i_shap2ra(),
  SCM_SET_ARRAY_CONTIGUOUS_FLAG, SCM_CLR_ARRAY_CONTIGUOUS_FLAG so that
  scm_from_contiguous_array() can keep using them.
* libguile/deprecated.c (scm_from_contiguous_array): Move here from
  arrays.c.
* libguile/deprecated.h (scm_from_contiguous_array): Deprecate.
* NEWS: Add deprecation notice.
2016-11-23 13:05:49 +01:00
Andy Wingo
dc2a560264 Deprecate dynamic roots
* 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).
2016-11-21 23:09:21 +01:00
Andy Wingo
03ffd726df scm_timed_lock_mutex replaces scm_lock_mutex_timed
* libguile/deprecated.h:
* libguile/deprecated.c (scm_lock_mutex_timed): Deprecate.
* libguile/threads.h:
* libguile/threads.c (scm_timed_lock_mutex): New function.
  (scm_join_thread): Fix formatting.
  (scm_lock_mutex): Fix formatting and update to scm_timed_lock_mutex
  change.
  (scm_try_mutex): Update to scm_timed_lock_mutex.
2016-11-05 19:39:12 +01:00
Andy Wingo
56dd476af7 Back to simple unlock-mutex
* libguile/threads.c (scm_unlock_mutex): Bind to unlock-mutex.
* libguile/threads.h: Remove scm_unlock_mutex_timed.
* libguile/deprecated.h: Add scm_unlock_mutex_timed.
* libguile/deprecated.c (scm_unlock_mutex_timed): Deprecate.
* test-suite/tests/threads.test: Update unlock-mutex tests to use
  wait-condition-variable if they would wait on a cond.
2016-11-05 11:50:31 +01:00
Andy Wingo
7682461241 Replace scm_make_mutex_with_flags
* libguile/threads.c (enum fat_mutex_kind): New data type, replacing
  separate flags.
  (struct fat_mutex): Adapt.
  (make_fat_mutex): Fat mutexes can only be one of three kinds, not one
  of 4 kinds.  (Recursive unowned mutexes are not a thing.)
  (scm_make_mutex): Adapt.
  (scm_make_mutex_with_kind): New function, replacing
  scm_make_mutex_with_flags.  Still bound to make-mutex.
  (scm_make_recursive_mutex): Adapt.
  (fat_mutex_lock, fat_mutex_unlock): Adapt.
* libguile/threads.h (scm_make_mutex_with_kind): New decl.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_make_mutex_with_flags): Deprecate.
2016-11-05 11:16:46 +01:00
Andy Wingo
fcc6a7ba20 Deprecate critical sections
* NEWS: Deprecate critical sections.
* doc/ref/api-scheduling.texi (Critical Sections): Remove.
* libguile/async.c:
* libguile/async.h:
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/threads.c:
* libguile/threads.h: Deprecate critical section API.
2016-11-01 23:48:42 +01:00
Andy Wingo
59f09d185b Deprecate user asyncs
* libguile/async.c:
* libguile/async.h:
* libguile/deprecated.c:
* libguile/deprecated.h (scm_async, scm_async_mark, scm_run_asyncs):
  Deprecate these functions, which comprise the "users asyncs" facility.
* module/oop/goops.scm: Adapt to <async> deprecation.
* doc/ref/api-scheduling.texi:
* doc/ref/libguile-concepts.texi:
* doc/ref/libguile-foreign-objects.texi:
* doc/ref/posix.texi: Remove documentation on user asyncs, and replace
  references to "system asyncs" to be just "asyncs".
2016-10-17 21:58:08 +02:00
Andy Wingo
56d8d9a257 Deprecate arbiters
* 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.
2016-10-17 21:29:05 +02:00
Andy Wingo
cd51ce81d0 Use heap-allocated port types instead of ptobnums
This removes a limitation on the number of port types, simplifies the
API, and removes a central point of coordination.

* libguile/ports-internal.h (struct scm_t_port_type): Rename from
  scm_t_ptob_descriptor, now that it's private.  Add GOOPS class
  fields.
  (struct scm_t_port): Rename from struct scm_port, especially
  considering that deprecated.h redefines scm_port using the
  preprocessor :(.
* libguile/ports.h: Add definitions of SCM_PORT and SCM_PORT_TYPE,
  though the scm_t_port and scm_t_port_type types are incomplete.
  (SCM_TC2PTOBNUM, SCM_PTOBNUM, SCM_PTOBNAME): Remove, as there are no
  more typecodes for port types.
  (scm_c_num_port_types, scm_c_port_type_ref, scm_c_port_type_add_x):
  Remove.
  (scm_make_port_type): Return a scm_t_port_type*.  All methods adapted
  to take a scm_t_port_type* instead of a ptobnum.
  (scm_c_make_port_with_encoding, scm_c_make_port): Take a port type
  pointer instead of a tag.
  (scm_new_port_table_entry): Remove; not useful.
* libguile/ports.c: Remove things related to the port kind table.  Adapt
  uses of SCM_PORT_DESCRIPTOR / scm_t_ptob_descriptor to use
  SCM_PORT_TYPE and scm_t_port_type.
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/filesys.c:
* libguile/fports.c:
* libguile/fports.h:
* libguile/print.c:
* libguile/r6rs-ports.c:
* libguile/strports.c:
* libguile/strports.h:
* libguile/tags.h:
* libguile/vports.c:
* test-suite/standalone/test-scm-c-read.c: Adapt to change.
* libguile/goops.c (scm_class_of, make_port_classes)
  (scm_make_port_classes, create_port_classes): Adapt to store the
  classes in the ptob.
2016-05-13 18:31:29 +02:00
Andy Wingo
2bcb278a30 GOOPS: Deprecate "using-class" procs like slot-ref-using-class
* libguile/deprecated.h:
* libguile/goops.c:
* libguile/goops.h:
* libguile/deprecated.c (scm_slot_ref_using_class):
  (scm_slot_set_using_class_x):
  (scm_slot_bound_using_class_p):
  (scm_slot_exists_using_class_p): Deprecate.

* module/oop/goops.scm (slot-ref-using-class, slot-set-using-class!)
  (slot-bound-using-class?, slot-exists-using-class?): Deprecate.
  Change to check that `class' is indeed the class of `obj', as
  required, and then dispatch to slot-ref et al.
2015-01-23 16:16:03 +01:00
Andy Wingo
2b5812c64d Deprecate scm_get_keyword
* libguile/deprecated.c (scm_get_keyword): Deprecate.
* libguile/deprecated.h:
* libguile/goops.c:
* libguile/goops.h:
2015-01-23 16:16:01 +01:00
Andy Wingo
57898597ad Deprecate C exports of GOOPS classes.
* libguile/deprecated.h:
  (scm_class_boolean, scm_class_char, scm_class_pair)
  (scm_class_procedure, scm_class_string, scm_class_symbol)
  (scm_class_primitive_generic, scm_class_vector, scm_class_null)
  (scm_class_real, scm_class_complex, scm_class_integer)
  (scm_class_fraction, scm_class_unknown, scm_class_top)
  (scm_class_object, scm_class_class, scm_class_applicable)
  (scm_class_applicable_struct, scm_class_applicable_struct_with_setter)
  (scm_class_generic, scm_class_generic_with_setter, scm_class_accessor)
  (scm_class_extended_generic, scm_class_extended_generic_with_setter)
  (scm_class_extended_accessor, scm_class_method)
  (scm_class_accessor_method, scm_class_procedure_class)
  (scm_class_applicable_struct_class, scm_class_number, scm_class_list)
  (scm_class_keyword, scm_class_port, scm_class_input_output_port)
  (scm_class_input_port, scm_class_output_port, scm_class_foreign_slot)
  (scm_class_self, scm_class_protected, scm_class_hidden)
  (scm_class_opaque, scm_class_read_only, scm_class_protected_hidden)
  (scm_class_protected_opaque, scm_class_protected_read_only)
  (scm_class_scm, scm_class_int, scm_class_float)
  (scm_class_double, scm_port_class, scm_smob_class): Deprecate.

* libguile/deprecated.c:
* libguile/goops.c:
* libguile/goops.h: Adapt to deprecation.

* libguile/goops.h
* libguile/goops.c (scm_is_generic, scm_is_method): New interfaces.
  (SCM_GENERICP, SCM_METHODP): Change to use new interfaces.

* libguile/ports.c (scm_make_port_type):
* libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): Use internal
  names for the port and smob class arrays.
2015-01-23 16:16:00 +01:00
Andy Wingo
6c7dd9ebd3 Generics with setters have <applicable-struct-with-setter> layout
* libguile/goops.c (scm_sys_set_object_setter_x): Remove.  Instead, we
  use slot-set! of 'setter.
  (scm_i_define_class_for_vtable): Move lower in the file, and fold in
  scm_make_extended_class_from_symbol and make_class_from_symbol.
  Properly handle applicable structs with setters.
  (scm_class_applicable_struct_with_setter_class): New private capture.
  (scm_sys_bless_applicable_struct_vtables_x): Rename to take two
  arguments, and bless the second argument as an applicable struct with
  setter vtable.
  (scm_sys_goops_early_init): Capture setter classes.

* libguile/deprecated.c (SPEC_OF, CPL_OF): Access slots by name, not by
  index.
  (applicablep, more_specificp): Adapt to use CPL_OF.
  (scm_find_method): Access "methods" slot by name.

* libguile/procs.c (scm_setter): Remove special case for generics; if
  it's a setter, it will be a normal applicable struct.
* module/oop/goops.scm (<applicable-struct-with-setter-class>)
  (<applicable-struct-with-setter>): New classes.
  (<generic-with-setter>): Now an instance of the setter metaclass and a
  child of the setter class, so that the "setter" slot ends up in the
  right place.
  (<accessor>, <extended-generic-with-setter>, <extended-accessor>): Be
  instances of the setter metaclass.
  (<method>, <accessor-method>): Move definitions farther down.
  (make): Use slot-set! when initializing setters here.
  (initialize): Likewise for <applicable-struct-with-setter>.  Remove
  specialization for <generic-with-setter>.
2015-01-23 16:16:00 +01:00
Andy Wingo
9e2cd55ec8 Remove unused CPP defines naming <method> slots
* libguile/goops.h (scm_si_generic_function, scm_si_specializers)
  (scm_si_procedure, scm_si_formals, scm_si_body)
  (scm_si_make_procedure): Remove unused CPP defines.
2015-01-23 16:16:00 +01:00
Andy Wingo
623559f311 Deprecate scm_no_applicable_method C export
* libguile/deprecated.c (scm_init_deprecated_goops)
  (scm_no_applicable_method):
* libguile/goops.h:
* libguile/goops.c (scm_no_applicable_method)
  (scm_sys_goops_early_init): Deprecate scm_no_applicable_method C
  export.
2015-01-23 16:16:00 +01:00
Andy Wingo
28b818d303 Deprecate scm_basic_make_class
* libguile/deprecated.h:
* libguile/deprecated.c (scm_basic_make_class): Deprecate.

* libguile/goops.c:
* libguile/goops.h (scm_make_standard_class): New internal helper.  It's
  a better spelling, as it matches make-standard-class, and is internal
  so as not to cause confusion between boot GOOPS helpers and "real"
  GOOPS interfaces.
2015-01-23 16:16:00 +01:00
Andy Wingo
e4aa440a2f Deprecate C interfaces scm_compute_applicable_methods, scm_find_method
* libguile/deprecated.h:
* libguile/deprecated.c (scm_compute_applicable_methods): Deprecate.
  This was the boot version of compute-applicable-methods, not the full
  version; the right thing to do is to call scheme.
  (scm_find_method): Deprecate.  Again, the right thing is to do this on
  the Scheme level.

* libguile/goops.c:
* libguile/goops.h: Deprecated code moved to deprecated.[ch].
2015-01-23 16:15:59 +01:00
Andy Wingo
c2247b782a Out-of-memory situations raise exceptions instead of aborting
* libguile/gc.c (scm_oom_fn, scm_init_gc): Install an out-of-memory
  handler that raises an unwind-only out-of-memory exception.
  (scm_gc_warn_proc, scm_init_gc): Install a warning proc that tries to
  print to the current warning port, if the current warning port is a
  file port.
  (scm_gc_after_nonlocal_exit): New interface.  Should be called after a
  nonlocal return to potentially collect memory; otherwise allocations
  could try to expand again when they should collect.

* libguile/continuations.c (scm_i_make_continuation):
* libguile/eval.c (eval):
* libguile/throw.c (catch):
* libguile/vm.c (scm_call_n): Call scm_gc_after_nonlocal_exit after
  nonlocal returns.

* libguile/throw.c (abort_to_prompt, throw_without_pre_unwind): Rework
  to avoid allocating memory.
  (scm_report_out_of_memory): New interface.
  (scm_init_throw): Pre-allocate the arguments for stack-overflow and
  out-of-memory errors.

* module/ice-9/boot-9.scm: Add an out-of-memory exception printer.
* module/system/repl/error-handling.scm (call-with-error-handling): Add
  out-of-memory to the report-keys set.

* libguile/gc-malloc.c (scm_realloc): Call scm_report_out_of_memory if
  realloc fails.

* libguile/error.h:
* libguile/error.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_memory_error): Deprecate.

* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-out-of-memory: New test case.
2014-03-22 15:49:31 +01:00
Andy Wingo
05326efbb1 Remove generalized vector interface; deprecated in 2.0 already.
* libguile/deprecated.c: Remove the generalized-vector interface,
  deprecated since 2.0.8.
2013-11-27 19:31:09 +01:00
Andy Wingo
9b977c836b Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/array-handle.c
	libguile/deprecated.h
	libguile/inline.c
	libguile/inline.h
	module/ice-9/deprecated.scm
	module/language/tree-il/peval.scm
2013-02-18 17:59:38 +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
d192791373 deprecate struct-vtable-tag
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/struct.c:
* libguile/struct.h:
* doc/ref/api-compound.texi: Deprecate struct-vtable-tag.
2012-07-06 18:12:59 +02:00
Ludovic Courtès
e80494083a Fix invalid use of `SCM' as a Boolean.
* libguile/deprecated.c (scm_sym2var): Check `scm_is_true (definep)'.
2012-06-08 12:44:07 +02:00
Andy Wingo
747747ee06 Merge remote-tracking branch 'origin/stable-2.0'
This commit removes code that was newly deprecated in stable-2.0.

Conflicts:
	libguile/deprecated.c
	libguile/deprecated.h
	libguile/modules.c
	module/ice-9/boot-9.scm
	module/ice-9/deprecated.scm
2012-05-23 12:38:56 +02:00
Andy Wingo
2de74cb56e finish deprecating eval closures
* libguile/deprecated.h:
* libguile/deprecated.c (scm_eval_closure_lookup)
  (scm_standard_eval_closure, scm_standard_interface_eval_closure)
  (scm_eval_closure_module): Deprecate these, as they are unused.

* libguile/modules.h:
* libguile/modules.c: Remove deprecated code.

* module/oop/goops/util.scm (top-level-env, top-level-env?): Deprecate.

* module/ice-9/deprecated.scm (set-system-module!): Deprecate.
  (module-eval-closure): Deprecate, by overriding the core definition to
  return a fresh eval closure.

* module/ice-9/boot-9.scm (make-module): Don't set an eval closure on
  the module.
  (the-root-module, the-scm-module): Don't call set-system-module!.
2012-05-23 12:29:15 +02:00
Andy Wingo
3f48638c8c deprecate lookup closures
* libguile/deprecated.h (SCM_TOP_LEVEL_LOOKUP_CLOSURE):
* libguile/deprecated.c (scm_lookup_closure_module):
  (scm_module_lookup_closure):
  (scm_current_module_lookup_closure): Deprecate this part of the eval
  closure interface.  It was unused internally, after the scm_sym2var
  refactor.

* libguile/eval.h:
* libguile/modules.c:
* libguile/modules.h: Remove deprecated code.

* libguile/goops.c (scm_ensure_accessor): Use scm_module_variable
  instead of calling the lookup closure.  However I'm not sure that this
  code is used at all.
2012-05-23 12:00:23 +02:00
Andy Wingo
62e15979b5 deprecate scm_sym2var
* libguile/deprecated.h:
* libguile/deprecated.c (scm_sym2var): Deprecate this function.

* libguile/modules.h:
* libguile/modules.c (scm_module_ensure_local_variable): New public
  function, replacing scm_sym2var with a true definep, without going
  through eval closures (which are deprecated).
  (scm_current_module): Rework to do something sensible before modules
  are booted.
  (scm_module_lookup, scm_lookup): Refactor to use scm_module_variable.
  (scm_module_define, scm_define): Refactor to use
  scm_module_ensure_local_variable.

* libguile/vm-i-system.c (define!): Use scm_define.

* libguile/vm.c (resolve_variable): Use scm_module_lookup.

* libguile/macros.c (scm_make_syntax_transformer): Use
  scm_module_variable.

* libguile/gdbint.c (gdb_binding): Use scm_define.

* doc/ref/api-modules.texi (Accessing Modules from C): Add docs for
  scm_module_ensure_local_variable.
2012-05-23 11:49:16 +02:00
Andy Wingo
4f5fb35194 deprecate SCM_ASRTGO
* 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-08 14:27:03 +01:00
Ludovic Courtès
36722c6384 Fix compilation of `deprecated.c' with SCM_DEBUG_TYPING_STRICTNESS=2.
* libguile/deprecated.c (init_module_stuff,
  scm_primitive_make_property): Use `scm_is_false' instead of direct
  comparison to SCM_BOOL_F'.
  (maybe_close_port, scm_close_all_ports_except): Use `SCM2PTR' and
  `PTR2SCM' instead of wild casts.
2011-10-22 16:48:46 +02:00
Andy Wingo
08969a2407 fix --disable-modules build
* 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.
2011-06-30 12:26:31 +02:00
Andy Wingo
ebc16e6a76 Merge remote-tracking branch 'local-2.0/stable-2.0' 2011-05-26 17:03:23 +02:00
Andy Wingo
65619ebe9a deprecate scm_immutable_{double_,}cell
* libguile/inline.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_immutable_cell, scm_immutable_double_cell):
  Deprecate these, as the GC_STUBBORN API doesn't do anything any more.

* libguile/strings.c (scm_i_c_make_symbol): Change the one use of
  scm_immutable_double_cell to scm_double_cell.
2011-05-26 12:34:30 +02:00
Andy Wingo
86fb1eb631 merge strictness branch from 2.0 2011-05-13 15:45:43 +02:00
Andy Wingo
b2feee6bc0 deprecate scm_internal_dynamic_wind
* libguile/dynwind.c:
* libguile/dynwind.h:

* libguile/deprecated.h (scm_t_inner):
* libguile/deprecated.c (scm_internal_dynamic_wind): Deprecate, as the
  scm_dynwind API is better, and this API encourages users to stuff SCM
  values into pointers.
2011-05-13 13:49:30 +02:00
Andy Wingo
fc7bd367ab remove all deprecated code
* libguile/async.c:
* libguile/async.h:
* libguile/debug.h:
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/evalext.h:
* libguile/gc-malloc.c:
* libguile/gc.h:
* libguile/gen-scmconfig.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/ports.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/read.c:
* libguile/socket.c:
* libguile/srfi-4.h:
* libguile/strings.c:
* libguile/strings.h:
* libguile/tags.h:
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm: Remove all deprecated code.  CPP defines
  that were not previously issuing warnings were changed so that their
  expansions would indicate the replacement forms to use,
  e.g. scm_sizet__GONE__REPLACE_WITH__size_t.

  The two exceptions were SCM_LISTN, which did not produce warnings
  before, and the string-filter argument order stuff.

  Drops the initial dirty memory usage of Guile down to 2.8 MB on my
  machine, from 4.4 MB.
2011-05-12 14:01:26 +02:00
Andy Wingo
f3c6a02c88 deprecate scm_struct_table
* libguile/goops.h:
* libguile/goops.c (scm_i_define_class_for_vtable): New internal helper,
  defines a class for a vtable, relying on the name slot being set
  correctly.
  (scm_class_of, create_struct_classes): Use the local vtable-to-class
  map instead of scm_struct_table.

* libguile/struct.h (SCM_STRUCT_TABLE_NAME, SCM_SET_STRUCT_TABLE_NAME)
  (SCM_STRUCT_TABLE_CLASS, SCM_SET_STRUCT_TABLE_CLASS, scm_struct_table)
  (scm_struct_create_handle): Deprecate these internals of the map
  between structs and classes.

* libguile/deprecated.h:
* libguile/deprecated.c (scm_struct_create_handle): Deprecated code over
  here now.
2011-05-01 23:01:14 +02:00
Andy Wingo
4466db75da deprecated primitive-properties don't get handles from weak hash tables
* libguile/deprecated.c (scm_primitive_property_ref)
  (scm_primitive_property_set_x): Avoid getting handles to elements in a
  weak hash table, as that's not going to work very well.
2011-05-01 20:55:58 +02:00
Andy Wingo
d1c4720ca3 deprecate scm_whash API
* libguile/deprecated.h:
* libguile/deprecated.c (scm_whash_get_handle, SCM_WHASHFOUNDP)
  (SCM_WHASHREF, SCM_WHASHSET, scm_whash_create_handle)
  (scm_whash_lookup, scm_whash_insert): Deprecate this API.

* libguile/srcprop.c:
* libguile/srcprop.h:
* libguile/read.c (scm_read_sexp): Use the hashq API instead of the
  whash API.
2011-05-01 20:55:50 +02:00
Ludovic Courtès
190d4b0d93 Make VM string literals immutable.
* libguile/strings.c (scm_i_make_string, scm_i_make_wide_string): Add
  `read_only_p' parameter.  All callers updated.

* libguile/vm-i-loader.c (load_string, load_wide_string): Push read-only
  strings.

* test-suite/tests/strings.test ("literals"): New test prefix.
2011-03-20 23:34:42 +01:00
Andy Wingo
7948811252 deprecate primitive properties
* libguile.h:
* libguile/Makefile.am:
* libguile/deprecated.h:
* libguile/deprecated.c:
* libguile/init.c:
* libguile/properties.c:
* libguile/properties.h: Deprecate the "primitive properties"
  interface.  It was only used to implement object properties, and that
  is no longer the case.

* module/ice-9/boot-9.scm (make-object-property): Reimplement just in
  terms of weak hash tables, and make threadsafe.

* NEWS:
* doc/ref/api-utility.texi: Update.
2011-02-10 23:16:52 +01:00
Ralf Wildenhues
ffb62a43dc fix typos in the manual bits generated from source comments.
* libguile/bitvectors.c, libguile/chars.c,
libguile/deprecated.c, libguile/numbers.c, libguile/random.c,
libguile/read.c, libguile/root.c, libguile/srfi-1.c,
libguile/srfi-13.c, libguile/srfi-14.c, libguile/uniform.c:
Fix typos, add missing newlines.
2011-02-09 22:28:49 +00:00
Andy Wingo
cd28785f79 deprecate cuserid
* libguile/posix.c:
* libguile/posix.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_cuserid): Deprecate cuserid, as it only
  returns 8 bytes of a user's login.

* doc/ref/posix.texi: Remove cuserid from docs.
2010-11-18 11:15:16 +01:00
Andy Wingo
8a4ed2dd34 remove "discouraged" infrastructure
* libguile/discouraged.h: Remove.

* libguile/deprecated.c (scm_internal_select, scm_thread_sleep)
  (scm_thread_usleep): Deprecate formerly discouraged names.

* libguile/eq.h (SCM_EQ_P):
* libguile/pairs.h (SCM_NULLP, SCM_NNULLP, SCM_CONSP, SCM_NCONSP):
* libguile/boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOLP, SCM_BOOL):
  (SCM_NEGATE_BOOL, SCM_BOOL_NOT): Undiscourage these names, because I'm
  not sure deprecating them will do any good.

* libguile.h:
* libguile/gen-scmconfig.c:
* libguile/numbers.c:
* libguile/init.c:
* libguile/Makefile.am:
* configure.ac: Remove bits that referenced discouraged.h, and dealt
  with the "discouraging" system.
2010-08-08 14:15:47 +02:00
Andy Wingo
220058a835 deprecated all discouraged functions
* libguile/Makefile.am:
* libguile/discouraged.c: Remove discouraged.c.

* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/discouraged.h: All functions and declarations moved from
  discouraged.[ch] to deprecated.[ch], adding deprecation warnings.

* libguile/init.c: Remove discouraged init.

* libguile/numbers.c (scm_num2float, scm_num2double): Deprecate.

* test-suite/standalone/test-num2integral.c: Port to modern API.
2010-08-08 13:48:35 +02:00
Ludovic Courtès
5b46a8c2c8 Use "pointer" instead of "foreign" when dealing with wrapped pointers.
* libguile/foreign.h (scm_t_foreign_finalizer): Rename to...
  (scm_t_pointer_finalizer): ... this.
  (SCM_FOREIGN_P): Rename to...
  (SCM_POINTER_P): this.
  (SCM_VALIDATE_FOREIGN): Rename to...
  (SCM_VALIDATE_POINTER): ... this.
  (SCM_FOREIGN_HAS_FINALIZER): Rename to...
  (SCM_POINTER_HAS_FINALIZER): ... this.
  (scm_take_foreign_pointer): Rename to...
  (scm_from_pointer): ... this.
  (scm_foreign_address): Rename to...
  (scm_pointer_address): ... this.
  (scm_foreign_to_bytevector): Rename to...
  (scm_pointer_to_bytevector): ... this.
  (scm_foreign_set_finalizer_x): Rename to...
  (scm_set_pointer_finalizer_x): ... this.
  (scm_bytevector_to_foreign): Rename to...
  (scm_bytevector_to_pointer): ... this.
  (scm_i_foreign_print): Rename to...
  (scm_i_pointer_print): ... this.

* libguile/foreign.c: Update accordingly.

* libguile/tags.h (scm_tc7_foreign): Rename to...
  (scm_tc7_pointer): ... this.

* libguile/foreign.c, libguile/deprecated.c, libguile/dynl.c,
  libguile/evalext.c, libguile/gc.c, libguile/goops.c, libguile/gsubr.c,
  libguile/gsubr.h, libguile/print.c, libguile/snarf.h,
  libguile/vm-i-system.c, module/system/foreign.scm,
  test-suite/standalone/test-ffi, test-suite/tests/foreign.test: Update
  accordingly.
2010-07-28 12:24:25 +02:00
Ludovic Courtès
d4149a510e Simplify the (system foreign) API.
Suggested by Neil Jerram.

* libguile/foreign.h (SCM_FOREIGN_TYPE, SCM_FOREIGN_VALUE_REF,
  SCM_FOREIGN_VALUE_SET, SCM_FOREIGN_LEN, SCM_FOREIGN_TYPED_P,
  SCM_FOREIGN_VALUE_P, SCM_VALIDATE_FOREIGN_VALUE, scm_foreign_set_x,
  scm_foreign_type): Remove.
  (scm_foreign_ref): Rename to...
  (scm_foreign_address): ... this.
  (scm_take_foreign_pointer): Update.
  (SCM_FOREIGN_POINTER): Remove CTYPE argument.  Update callers.
  (scm_make_pointer): New declaration.

* libguile/foreign.c (scm_to_uintptr, scm_from_uintptr): New macros.
  (scm_make_pointer): New function.
  (scm_take_foreign_pointer): Remove TYPE and LEN arguments.  Update
  callers.
  (scm_foreign_ref): Remove to...
  (scm_foreign_address): ... this.  Remove type-related code.
  (scm_foreign_set_x): Remove.
  (scm_foreign_to_bytevector): Change argument order; make LEN argument
  compulsory.
  (scm_i_foreign_print): Remove type printing.
  (unpack): Remove foreign-type checking.

* libguile/deprecated.c (scm_dynamic_args_call): Update accordingly.

* libguile/dynl.c (scm_dynamic_pointer): Remove the TYPE and LEN
  arguments; update callers.  Update to the new foreign API.

* libguile/dynl.h (scm_dynamic_pointer): Update.

* libguile/gsubr.c (create_gsubr): Update to the new foreign API.

* libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_GENERIC): Ditto.

* libguile/snarf.h (SCM_IMMUTABLE_FOREIGN): Ditto.

* libguile/vm-i-system.c (subr_call): Ditto.

* module/system/foreign.scm (null-pointer?): New procedure.

* test-suite/standalone/test-ffi: Update to the new
  `bytevector->foreign' signature.

* test-suite/tests/foreign.test ("null pointer")["null pointer
  identity", "null-pointer? %null-pointer"]: New tests.
  ["foreign-set! other-null-pointer", "foreign->bytevector
  other-null-pointer"]: Remove.
  ("make-pointer", "foreign<->bytevector"): New test prefixes.
2010-07-26 19:38:52 +02:00
Andy Wingo
ec16eb7847 deprecate the-last-stack
* libguile/backtrace.h (scm_the_last_stack_fluid_var)
* libguile/backtrace.c (scm_init_backtrace): No more
  scm_the_last_stack_fluid_var. The replacement is to resolve
  `the-last-stack' in (ice-9 stack-catch).
  (scm_backtrace_with_highlights): Accordingly, instead of backtracing
  the last stack, backtrace the current stack.

* libguile/throw.h:
* libguile/throw.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_internal_stack_catch): Deprecate this
  function.

* module/ice-9/save-stack.scm (the-last-stack): Move here from boot-9.

* module/ice-9/debug.scm:
* module/ice-9/debugger.scm: Use (ice-9 save-stack) for the-last-stack.

* module/ice-9/deprecated.scm (the-last-stack): Add deprecated shim.
2010-06-19 13:43:33 +02:00