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

119 commits

Author SHA1 Message Date
Andy Wingo
1234bb1850 Update license notices in all C files
Update to newest recommended license notices from the FSF.  Everything
stays LGPLv3+ except guile-readline which is GPLv3+.
2018-06-20 20:07:34 +02:00
Andy Wingo
791eb0c01a Remove (C) from copyright statements
As the FSF advises, 'There is no legal significance to using the
three-character sequence “(C)”, but it does no harm.'  It does take up
space though!  For that reason, we remove it here from our C files.
2018-06-20 19:17:06 +02:00
Andy Wingo
97cc65fee4 Rename __scm.h to scm.h
* libguile/scm.h: Rename.  Update all includers.
2018-06-20 16:33:33 +02:00
Andy Wingo
c495b44714 Remove Emacs local variables comments in Guile source
The .dir-locals.el file in the repository is sufficient for Emacs
users.

* libguile/__scm.h:
* libguile/alist.c:
* libguile/alist.h:
* libguile/array-handle.c:
* libguile/array-handle.h:
* libguile/array-map.c:
* libguile/array-map.h:
* libguile/arrays.c:
* libguile/arrays.h:
* libguile/async.c:
* libguile/async.h:
* libguile/backtrace.c:
* libguile/backtrace.h:
* libguile/bitvectors.c:
* libguile/bitvectors.h:
* libguile/boolean.c:
* libguile/boolean.h:
* libguile/chars.c:
* libguile/chars.h:
* libguile/chooks.c:
* libguile/chooks.h:
* libguile/continuations.c:
* libguile/continuations.h:
* libguile/control.c:
* libguile/conv-integer.i.c:
* libguile/debug-malloc.h:
* libguile/debug.c:
* libguile/debug.h:
* libguile/deprecation.c:
* libguile/deprecation.h:
* libguile/dynl.c:
* libguile/dynl.h:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/dynwind.c:
* libguile/dynwind.h:
* libguile/eq.c:
* libguile/eq.h:
* libguile/error.c:
* libguile/error.h:
* libguile/eval.c:
* libguile/eval.h:
* libguile/evalext.c:
* libguile/evalext.h:
* libguile/expand.c:
* libguile/expand.h:
* libguile/extensions.c:
* libguile/extensions.h:
* libguile/feature.c:
* libguile/feature.h:
* libguile/filesys.c:
* libguile/filesys.h:
* libguile/fluids.c:
* libguile/fluids.h:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/fports.h:
* libguile/frames.c:
* libguile/frames.h:
* libguile/gc-inline.h:
* libguile/gc.c:
* libguile/gc.h:
* libguile/generalized-arrays.c:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.c:
* libguile/generalized-vectors.h:
* libguile/gettext.c:
* libguile/gettext.h:
* libguile/goops.c:
* libguile/goops.h:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/guardians.c:
* libguile/guardians.h:
* libguile/guile.c:
* libguile/hash.c:
* libguile/hash.h:
* libguile/hashtab.c:
* libguile/hashtab.h:
* libguile/hooks.c:
* libguile/hooks.h:
* libguile/i18n.c:
* libguile/i18n.h:
* libguile/init.c:
* libguile/init.h:
* libguile/instructions.c:
* libguile/instructions.h:
* libguile/intrinsics.c:
* libguile/intrinsics.h:
* libguile/ioext.c:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.c:
* libguile/keywords.h:
* libguile/list.c:
* libguile/list.h:
* libguile/load.c:
* libguile/load.h:
* libguile/loader.c:
* libguile/loader.h:
* libguile/macros.c:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memmove.c:
* libguile/memoize.c:
* libguile/memoize.h:
* libguile/modules.c:
* libguile/modules.h:
* libguile/net_db.c:
* libguile/net_db.h:
* libguile/null-threads.c:
* libguile/null-threads.h:
* libguile/numbers.c:
* libguile/numbers.h:
* libguile/objprop.c:
* libguile/objprop.h:
* libguile/options.c:
* libguile/options.h:
* libguile/pairs.c:
* libguile/pairs.h:
* libguile/poll.c:
* libguile/poll.h:
* libguile/ports.c:
* libguile/ports.h:
* libguile/posix.c:
* libguile/posix.h:
* libguile/print.c:
* libguile/print.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/procs.c:
* libguile/procs.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/promises.c:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.c:
* libguile/random.h:
* libguile/rdelim.c:
* libguile/rdelim.h:
* libguile/read.c:
* libguile/read.h:
* libguile/regex-posix.c:
* libguile/regex-posix.h:
* libguile/rw.c:
* libguile/rw.h:
* libguile/scmsigs.c:
* libguile/scmsigs.h:
* libguile/script.c:
* libguile/script.h:
* libguile/simpos.c:
* libguile/simpos.h:
* libguile/smob.c:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.c:
* libguile/socket.h:
* libguile/sort.c:
* libguile/sort.h:
* libguile/srcprop.c:
* libguile/srcprop.h:
* libguile/stackchk.c:
* libguile/stackchk.h:
* libguile/stacks.c:
* libguile/stacks.h:
* libguile/stime.c:
* libguile/stime.h:
* libguile/strerror.c:
* libguile/strings.c:
* libguile/strings.h:
* libguile/strorder.c:
* libguile/strorder.h:
* libguile/strports.c:
* libguile/strports.h:
* libguile/struct.c:
* libguile/struct.h:
* libguile/symbols.c:
* libguile/symbols.h:
* libguile/syntax.c:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.c:
* libguile/threads.h:
* libguile/throw.c:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.c:
* libguile/unicode.h:
* libguile/uniform.c:
* libguile/uniform.h:
* libguile/values.c:
* libguile/values.h:
* libguile/variable.c:
* libguile/variable.h:
* libguile/vectors.c:
* libguile/vectors.h:
* libguile/version.c:
* libguile/vm-engine.c:
* libguile/vm-expand.h:
* libguile/vm.c:
* libguile/vm.h:
* libguile/vports.c:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.c:
* libguile/weak-set.h:
* libguile/weak-table.c:
* libguile/weak-table.h:
* libguile/weak-vector.c:
* libguile/weak-vector.h: Remove needless trailing comments.
2018-06-20 14:32:28 +02:00
Andy Wingo
5534c2817e Remove useless "classes: h_files" from Guile headers.
* libguile/__scm.h:
* libguile/alist.h:
* libguile/array-handle.h:
* libguile/array-map.h:
* libguile/arrays.h:
* libguile/async.h:
* libguile/backtrace.h:
* libguile/bitvectors.h:
* libguile/boolean.h:
* libguile/chars.h:
* libguile/chooks.h:
* libguile/continuations.h:
* libguile/debug-malloc.h:
* libguile/debug.h:
* libguile/deprecation.h:
* libguile/dynl.h:
* libguile/dynstack.h:
* libguile/dynwind.h:
* libguile/eq.h:
* libguile/error.h:
* libguile/eval.h:
* libguile/evalext.h:
* libguile/expand.h:
* libguile/extensions.h:
* libguile/feature.h:
* libguile/filesys.h:
* libguile/fluids.h:
* libguile/fports.h:
* libguile/gc-inline.h:
* libguile/gc.h:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.h:
* libguile/gettext.h:
* libguile/goops.h:
* libguile/gsubr.h:
* libguile/guardians.h:
* libguile/hash.h:
* libguile/hashtab.h:
* libguile/hooks.h:
* libguile/i18n.h:
* libguile/init.h:
* libguile/inline.h:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.h:
* libguile/list.h:
* libguile/load.h:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memoize.h:
* libguile/modules.h:
* libguile/net_db.h:
* libguile/null-threads.h:
* libguile/numbers.h:
* libguile/objprop.h:
* libguile/options.h:
* libguile/pairs.h:
* libguile/poll.h:
* libguile/ports.h:
* libguile/posix-w32.h:
* libguile/posix.h:
* libguile/print.h:
* libguile/procprop.h:
* libguile/procs.h:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.h:
* libguile/rdelim.h:
* libguile/read.h:
* libguile/regex-posix.h:
* libguile/rw.h:
* libguile/scmsigs.h:
* libguile/script.h:
* libguile/simpos.h:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.h:
* libguile/sort.h:
* libguile/srcprop.h:
* libguile/stackchk.h:
* libguile/stacks.h:
* libguile/stime.h:
* libguile/strings.h:
* libguile/strorder.h:
* libguile/strports.h:
* libguile/struct.h:
* libguile/symbols.h:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.h:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.h:
* libguile/uniform.h:
* libguile/values.h:
* libguile/variable.h:
* libguile/vectors.h:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.h:
* libguile/weak-table.h:
* libguile/weak-vector.h: Remove "classes: h_files".  Reformat
  copyrights if needed.
2018-06-20 14:26:16 +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
Mark H Weaver
07c2ca0f0d Rename scm_call_varargs -> scm_call
* libguile/eval.c, libguile/eval.h, doc/ref/api-evaluation.texi,
  test-suite/standalone/test-loose-ends.c, NEWS: Rename
  scm_call_varargs -> scm_call

Suggested by Ludovic Courtès <ludo@gnu.org>
2012-01-30 11:02:29 -05:00
Mark H Weaver
741b8a2300 Implement scm_call_varargs and scm_call_{7,8,9}
* libguile/eval.c (scm_call_7, scm_call_8, scm_call_9,
  scm_call_varargs): New functions.

* libguile/eval.h: Add prototypes.

* doc/ref/api-evaluation.texi: Add documentation.

* test-suite/standalone/test-loose-ends.c: Add tests.

* NEWS: Add news entry.
2012-01-30 10:27:44 -05:00
Andy Wingo
f32e67be0b add scm_call_{5,6}
* libguile/eval.h:
* libguile/eval.c (scm_call_5, scm_call_6): New scm_call functions; why
  not.
2011-03-08 21:02:36 +01:00
Andy Wingo
cc00f44743 scm_badargsp is deprecated
* libguile/eval.h:
* libguile/eval.c:
* libguile/deprecated.h
* libguile/deprecated.c (scm_badargsp): Deprecate scm_badargsp.
2010-05-13 23:37:15 +02:00
Andy Wingo
86fd6dff2a add scm_call_n, scm_c_run_hookn
* libguile/eval.h:
* libguile/eval.c (scm_call_n): New function, applies a function to an
  array of args.

* libguile/hooks.h:
* libguile/hooks.c (scm_c_run_hookn): New function, runs a hook with an
  array of args.
2009-12-21 21:06:27 +01:00
Andy Wingo
314b87163e eval.c closures are now applicable smobs, not tc3s
* libguile/debug.c (scm_procedure_name): Remove a SCM_CLOSUREP case and
  some dead code.
  (scm_procedure_module): Remove. This was introduced a few months ago
  for the hygienic expander, but now it is no longer needed, as the
  expander keeps track of this information itself.

* libguile/debug.h: Remove scm_procedure_module.

* libguile/eval.c: Instead of using tc3 closures, define a "boot
  closure" applicable smob type, and represent closures with that. The
  advantage is that after eval.scm is compiled, boot closures take up no
  address space (besides a smob number) in the runtime, and require no
  special cases in procedure dispatch.

* libguile/eval.h: Remove the internal functions scm_i_call_closure_0
  and scm_closure_apply, and the public function scm_closure.

* libguile/gc.c (scm_storage_prehistory): No tc3_closure displacement
  registration.
  (scm_i_tag_name): Remove closure case, and a dead cclo case.

* libguile/vm.c (apply_foreign):
* libguile/print.c (iprin1):
* libguile/procs.c (scm_procedure_p, scm_procedure_documentation);
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/goops.c (scm_class_of): Remove tc3_closure/tcs_closure cases.
* libguile/hash.c (scm_hasher):

* libguile/hooks.c (scm_add_hook_x): Use new scm_i_procedure_arity.

* libguile/macros.c (macro_print): Print all macros using the same code.
  (scm_macro_transformer): Return any procedure, not just programs.

* libguile/procprop.h:
* libguile/procprop.c (scm_i_procedure_arity): Instead of returning a
  list that the caller has to parse, have the same prototype as
  scm_i_program_arity. An incompatible change, but it's an internal
  function anyway.
  (scm_procedure_properties, scm_set_procedure_properties)
  (scm_procedure_property, scm_set_procedure_property): Remove closure
  cases, and use scm_i_program_arity for arity.

* libguile/procs.h (SCM_CLOSUREP, SCM_CLOSCAR, SCM_CODE)
  (SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS)
  (SCM_CLOSURE_BODY, SCM_PROCPROPS, SCM_SETPROCPROPS, SCM_ENV)
  (SCM_TOP_LEVEL): Remove these macros that pertain to boot closures
  only. Only eval.c should know abut boot closures.
* libguile/procs.c (scm_closure_p): Remove this function. There is a
  simple stub in deprecated.scm now.
  (scm_thunk_p): Use scm_i_program_arity.
* libguile/tags.h (scm_tc3_closure): Remove. Yay, another tc3 to play
  with!
  (scm_tcs_closures): Remove.

* libguile/validate.h (SCM_VALIDATE_CLOSURE): Remove.

* module/ice-9/deprecated.scm (closure?): Add stub.

* module/ice-9/documentation.scm (object-documentation)
* module/ice-9/session.scm (help-doc, arity)
* module/oop/goops.scm (compute-getters-n-setters)
* module/oop/goops/describe.scm (describe)
* module/system/repl/describe.scm (display-object, display-type):
  Remove calls to closure?.
2009-12-04 19:20:11 +01:00
Andy Wingo
23f276dea7 first step to make the vm stop calling the interpreter
* libguile/eval.h:
* libguile/eval.c (scm_closure_apply): New function, applies a closure.
  Won't be necessary in the future, but for now here it is, with
  internal linkage.

* libguile/gsubr.h:
* libguile/gsubr.c (scm_i_gsubr_apply_array): New function, applies a
  gsubr to an array of values, potentially extending that array for
  optional arguments and rest arguments and such.

* libguile/vm.c (apply_foreign): New function, applies a foreign
  function to arguments on the stack, in place.

* libguile/vm-i-system.c (call): Add a case for procedures-with-setters
  (will go away when they are applicable structs). Instead of calling
  the evaluator for foreign functions, call apply_foreign.
2009-12-01 21:59:42 +01:00
Andy Wingo
7b89381965 promises are in their own file now
* libguile.h:
* libguile/Makefile.am:
* libguile/eval.c:
* libguile/eval.h:
* libguile/init.c:
* libguile/promises.c:
* libguile/promises.h: Split promises out into their own file.
2009-12-01 21:00:26 +01:00
Andy Wingo
b7742c6b71 new evaluator, y'all
* libguile/eval.c: So, ladies & gents, a new evaluator. It's similar to
  the old one, in that we memoize and then evaluate, but in this
  incarnation, memoization of an expression happens before evaluation,
  not lazily as the expression is evaluated. This makes the evaluation
  itself much cleaner, in addition to being threadsafe. In addition,
  since this C evaluator will in the future just serve to bootstrap the
  Scheme evaluator, we don't have to pay much concern for debugging
  conveniences. So the environment is just a list of values, and the
  memoizer pre-computes where it's going to find each individual value
  in the environment.

  Interface changes are commented below, with eval.h.

  (scm_evaluator_traps): No need to reset the debug mode after rnning te
  traps thing. But really, the whole traps system needs some love.

* libguile/memoize.h:
* libguile/memoize.c: New memoizer, which runs before evaluation,
  checking all syntax before evaluation begins. Significantly, no
  debugging information is left for lexical variables, which is not so
  great for interactive debugging; perhaps we should change this to have
  a var list in the future as per the classic interpreters. But it's
  quite fast, and the resulting code is quite good. Also note that it
  doesn't produce ilocs, memoized code is a smob whose type is in the
  first word of the smob itself.

* libguile/eval.h (scm_sym_and, scm_sym_begin, scm_sym_case)
  (scm_sym_cond, scm_sym_define, scm_sym_do, scm_sym_if, scm_sym_lambda)
  (scm_sym_let, scm_sym_letstar, scm_sym_letrec, scm_sym_quote)
  (scm_sym_quasiquote, scm_sym_unquote, scm_sym_uq_splicing, scm_sym_at)
  (scm_sym_atat, scm_sym_atapply, scm_sym_atcall_cc)
  (scm_sym_at_call_with_values, scm_sym_delay, scm_sym_eval_when)
  (scm_sym_arrow, scm_sym_else, scm_sym_apply, scm_sym_set_x)
  (scm_sym_args): Remove public declaration of these symbols.
  (scm_ilookup, scm_lookupcar, scm_eval_car, scm_eval_body)
  (scm_eval_args, scm_i_eval_x, scm_i_eval): Remove public declaration
  of these functions.
  (scm_ceval, scm_deval, scm_ceval_ptr): Remove declarations of these
  deprecated functions.
  (scm_i_print_iloc, scm_i_print_isym, scm_i_unmemocopy_expr)
  (scm_i_unmemocopy_body): Remove declarations of these internal
  functions.
  (scm_primitive_eval_x, scm_eval_x): Redefine as macros for their less
  destructive siblings.

* libguile/Makefile.am: Add memoize.[ch] to the build.

* libguile/debug.h (scm_debug_mode_p, scm_check_entry_p)
  (scm_check_apply_p, scm_check_exit_p, scm_check_memoize_p)
  (scm_debug_eframe_size): Remove these vars that were tied to the old
  evaluator's execution model.
  (SCM_RESET_DEBUG_MODE): Remove, no more need for this.
  (SCM_MEMOIZEDP, SCM_MEMOIZED_EXP, SCM_MEMOIZED_ENV): Remove macros
  referring to old memoized code representation.
  (scm_local_eval, scm_procedure_environment, scm_memoized_environment)
  (scm_make_memoized, scm_memoized_p): Remove functions operating on old
  memoized code representation.
  (scm_memcons, scm_mem_to_proc, scm_proc_to_mem): Remove debug-only
  code for old evaluator.

* libguile/debug.c: Remove code to correspond with debug.h removals.
  (scm_debug_options): No need to set the debug mode or frame limit
  here, as we don't have C stack limits any more. Perhaps this is a bug,
  but as long as we can compile eval.scm, we should be fine.

* libguile/init.c (scm_i_init_guile): Init memoize.c.

* libguile/modules.c (scm_top_level_env, scm_env_top_level)
  (scm_env_module, scm_system_module_env_p): Remove these functions.

* libguile/print.c (iprin1): No more need to handle isyms. Adapt to new
  form of interpreted procedures.

* libguile/procprop.c (scm_i_procedure_arity): Adapt to new form of
  interpreted procedures.

* libguile/procs.c (scm_thunk_p): Adapt to new form of interpreted
  procedures.
* libguile/procs.h (SCM_CLOSURE_FORMALS): Removed, this exists no more.
  (SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS): New
  accessors.

* libguile/srcprop.c (scm_source_properties, scm_source_property)
  (scm_set_source_property_x): Remove special cases for memoized code.

* libguile/stacks.c (read_frame): Remove a source-property case for
  interpreted code.
  (NEXT_FRAME): Remove a case that I don't fully understand, that seems
  to be designed to skip over apply frames. Will be obsolete in the
  futures.
  (read_frames): Default source value for interpreted frames to #f.
  (narrow_stack): Don't pay attention to the system_module thing.

* libguile/tags.h: Remove isyms and ilocs. Whee!

* libguile/validate.h (SCM_VALIDATE_MEMOIZED): Fix to use the new
  MEMOIZED_P formulation.

* module/ice-9/psyntax-pp.scm (do, quasiquote, case): Adapt for these no
  longer being primitive macros.
* module/ice-9/boot-9.scm: Whitespace change, but just a poke to force a
  rebuild due to and/or/cond/... not being primitives any more.

* module/ice-9/deprecated.scm (unmemoize-expr): Deprecate, it's
  unmemoize-expression now.

* test-suite/tests/eval.test ("define set procedure-name"): XFAIL a
  couple of tests here; I don't know what to do about them. I reckon the
  expander should ensure that defined values are named.

* test-suite/tests/chars.test ("basic char handling"): Fix expected
  exception when trying to apply a char.
2009-12-01 21:00:26 +01:00
Andy Wingo
0f458a3725 factor copy-tree and cons-source out of eval.[ch]
* libguile.h:
* libguile/Makefile.am
* libguile/init.c (scm_i_init_guile): Add trees.[ch] to the build.

* libguile/eval.c:
* libguile/eval.h: Remove scm_copy_tree and scm_cons_source...

* libguile/trees.h:
* libguile/trees.c:
* libguile/srcprop.h:
* libguile/srcprop.c: ... factoring them out here and here,
  respectively.

* test-suite/tests/eval.test ("memoization"): Change expected exception
  for circular data structures, given new copy-tree location.
2009-12-01 21:00:26 +01:00
Ludovic Courtès
0eb934f1f0 Use `SCM_DEPRECATED' in declarations of deprecated functions/variables.
* libguile/deprecated.c (SCM_BUILDING_DEPRECATED_CODE): New macro.

* libguile/async.c (SCM_BUILDING_DEPRECATED_CODE): Likewise.

* libguile/macros.c (SCM_BUILDING_DEPRECATED_CODE): Likewise.

* libguile/async.h, libguile/deprecated.h, libguile/eval.h,
  libguile/gc.h, libguile/gc.h, libguile/macros.h, libguile/ports.h,
  libguile/srfi-4.h, libguile/strings.h: Change declarations of
  deprecated functions and variables to use `SCM_DEPRECATED' instead of
  `SCM_API'.
2009-10-02 14:48:22 +02:00
Ludovic Courtès
b3ce13b667 Remove deprecated semi-public memoizers.
* libguile/eval.c (scm_m_expand_body, scm_macroexp, scm_unmemocar):
  Remove.
  (scm_m_undefine): Make `static'.

* libguile/eval.h (scm_m_undefine, scm_m_expand_body, scm_unmemocar,
  scm_macroexp): Remove declarations.
2009-08-13 23:36:46 +02:00
Ludovic Courtès
4d0949ea45 Make the evaluator's memoizers private.
* libguile/eval.c (macroexp): Move upwards.
  (scm_m_quote, scm_m_begin, scm_m_if, scm_m_set_x, scm_m_and, scm_m_or,
  scm_m_case, scm_m_cond, scm_m_lambda, scm_m_letstar, scm_m_do,
  scm_m_quasiquote, scm_m_delay, scm_m_generalized_set_x,
  scm_m_define, scm_m_letrec, scm_m_let, scm_m_at, scm_m_atat,
  scm_m_apply, scm_m_cont, scm_m_nil_cond, scm_m_atfop,
  scm_m_atbind, scm_m_atslot_ref, scm_m_atslot_set_x,
  scm_m_at_call_with_values, scm_m_eval_when): New static
  declarations; definitions made static.
  (s_atslot_ref, s_atslot_set_x): New, from `goops.c'.

* libguile/eval.h (scm_m_quote, scm_m_begin, scm_m_if, scm_m_set_x,
  scm_m_vref, scm_m_vset, scm_m_and, scm_m_or, scm_m_case, scm_m_cond,
  scm_m_lambda, scm_m_letstar, scm_m_do, scm_m_quasiquote, scm_m_delay,
  scm_m_generalized_set_x, scm_m_future, scm_m_define, scm_m_letrec,
  scm_m_let, scm_m_at, scm_m_atat, scm_m_apply, scm_m_cont,
  scm_m_nil_cond, scm_m_atfop, scm_m_atbind, scm_m_atslot_ref,
  scm_m_atslot_set_x, scm_m_atdispatch, scm_m_at_call_with_values,
  scm_m_eval_when): Remove public declarations.

* libguile/goops.c (s_atslot_ref, s_atslot_set_x): Remove.
2009-08-13 23:30:49 +02:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Andy Wingo
9c35c5796c make sure we compile boot code in (guile), not (guile-user)
* libguile/eval.h:
* libguile/eval.c (scm_m_eval_when): Define a cheap eval-when, used
  before syncase has booted.

* module/Makefile.am: Reorder to put (system vm) and (system repl)
  modules after the compiler, as they are not needed at runtime.

* module/ice-9/boot-9.scm: Move the eval-when earlier, to be the first
  thing -- so when we recompile Guile we do so all in the '(guile)
  module, not '(guile-user).

* module/ice-9/compile-psyntax.scm: Rewrite to assume that psyntax.scm
  will eval-when to set its module, etc. Have everything in a let --
  otherwise the `format' call is in (guile), but `target' was defined
  in (guile-user). Also, write in an eval-when to the expanded file.

* module/ice-9/psyntax-pp.scm: Regenerate.

* module/ice-9/networking.scm:
* module/ice-9/psyntax.scm:
* module/ice-9/r4rs.scm: Sprinkles of eval-when, for flavor.
2009-04-24 23:10:31 +02:00
Andy Wingo
249bab1c53 @ and @@ as primitive macros
* libguile/eval.h:
* libguile/eval.c (error_unbound_variable, error_defined_variable):
  Move these prototypes up earlier.
  (scm_m_at, scm_m_atat): New functions, provide the @ and @@
  functionality. Moved here from defmacros because they are
  "special", inasmuch as syncase doesn't really understand them in
  interpreted code.

* module/ice-9/boot-9.scm (@, @@): Don't define as defmacros, as
  defmacros have to actually return source now.
2009-04-17 15:20:18 +02:00
Andy Wingo
7c455996e8 export `make-promise' to scheme
* libguile/eval.h:
* libguile/eval.c (scm_make_promise): Rename from `scm_makprom', and
  export as the scheme procedure, `make-promise'.

* libguile/eval.i.c (CEVAL): s/makprom/make_promise/.
2008-09-25 16:16:35 +02:00
Ludovic Courtès
102dbb6f6c Add `SCM_INTERNAL' macro, use it. 2008-05-31 23:21:02 +02:00
Han-Wen Nienhuys
22fc179acd * backtrace.c, debug.c, debug.h, deprecation.c, eq.c, eval.c
eval.h, gsubr.c, init.c, macros.c, print.c, print.h, read.c,
read.h, stacks.c, symbols.c, throw.c: use private-options.h

* private-options.h: new file: contain hardcoded option
definitions.
2007-01-22 15:14:40 +00:00
Han-Wen Nienhuys
72f19c2646 * debug.h (SCM_RESET_DEBUG_MODE): switch to debugging if
memoize-symbol is set.

* eval.h (SCM_MEMOIZE_HDLR): add macros for memoize symbol trap.

* eval.c (CEVAL): add memoize_symbol trap.

* read.c: idem.

* eval.c: terminate option lists with 0.
2007-01-19 20:05:05 +00:00
Han-Wen Nienhuys
6256065013 * readline.c: terminate option list with NULL.
* read.c: idem.

* print.c: idem.

* eval.c: terminate option lists with 0.

* options.c: remove n (for length) from scm_option_X
functions. Detect option list length by looking for NULL name.
2007-01-19 19:26:36 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Marius Vollmer
9de87eea47 See ChangeLog from 2005-03-02. 2005-03-02 20:42:01 +00:00
Marius Vollmer
76da80e788 Reverted changed from 2005/01/24 19:14:54, which was a commit to the
wrong branch.  Sorry.
2005-01-24 23:41:14 +00:00
Marius Vollmer
a54a94b397 Threading changes. 2005-01-24 19:14:54 +00:00
Dirk Herrmann
9fcf3cbb81 * backtrace.c (display_expression, display_frame): Call
scm_i_unmemoize_expr for unmemoizing a memoized object holding a
	single memoized expression.

	* debug.c (memoized_print): Don't try to unmemoize the memoized
	object, since we can't know whether it holds a single expression
	or a body.

	(scm_mem_to_proc): Removed check for lambda expression, since it
	was moot anyway.  Whoever uses these functions for debugging
	purposes should know what they do: Creating invalid memoized code
	will cause crashes, independent of whether this check is present
	or not.

	(scm_proc_to_mem): Take the closure's code as it is and don't
	append a SCM_IM_LAMBDA isym.  To allow easier debugging, the
	memoized code should not be modified.

	* debug.[ch] (scm_unmemoize, scm_i_unmemoize_expr): Removed
	scm_unmemoize from public use, but made scm_i_unmemoize_expr
	available as a guile internal function instead.  However,
	scm_i_unmemoize_expr will only work on memoized objects that hold
	a single memoized expression.  It won't work with bodies.

	* debug.c (scm_procedure_source), macros.c (macro_print), print.c
	(scm_iprin1): Call scm_i_unmemocopy_body for unmemoizing a body,
	i. e. a list of expressions.

	* eval.c (unmemoize_exprs): Drop internal body markers from the
	output during unmemoization.

	* eval.[ch] (scm_unmemocopy, scm_i_unmemocopy_expr,
	scm_i_unmemocopy_body): Removed scm_unmemocopy from public use,
	but made scm_i_unmemocopy_expr and scm_i_unmemocopy_body available
	as guile internal functions instead.  scm_i_unmemoize_expr will
	only work on a single memoized expression, while
	scm_i_unmemocopy_body will only work on bodies.
2004-06-27 12:34:54 +00:00
Marius Vollmer
f5710d53b1 Use SCM_SMOB_* instead of SCM_CELL_* as appropriate. Use
SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS instead of accessing the
zeroth word directly.  Use SCM_SMOB_PREDICATE as appropriate.
2004-05-06 16:43:14 +00:00
Dirk Herrmann
7e6e6b37ba Hide the implementation of ilocs and isyms in eval.c.
* deprecated.h (SCM_IFRINC, SCM_ICDR, SCM_IFRAME, SCM_IDIST,
	SCM_ICDRP), eval.c (SCM_IFRINC, SCM_ICDR, SCM_IFRAME, SCM_IDIST,
	SCM_ICDRP), eval.h (SCM_ICDR, SCM_IFRINC, SCM_IFRAME, SCM_IDIST,
	SCM_ICDRP): Deprecated and added to deprecated.h.  Moved from
	eval.h to eval.c.

	* deprecated.c (scm_isymnames), deprecated.h (scm_isymnames,
	SCM_ISYMNUM, SCM_ISYMCHARS), eval.c (SCM_ISYMNUM, isymnames,
	scm_unmemocopy, CEVAL), print.c (scm_isymnames), tags.h
	(SCM_ISYMNUM, scm_isymnames, SCM_ISYMCHARS): Deprecated
	scm_isymnames, SCM_ISYMNUM and SCM_ISYMCHARS and added to
	deprecated.[hc].  Moved scm_isymnames from print.c to eval.c and
	renamed to isymnames.  Moved SCM_ISYMNUM from tags.h to eval.c and
	renamed to ISYMNUM.

	* eval.c (scm_i_print_iloc, scm_i_print_isym), eval.h
	(scm_i_print_iloc, scm_i_print_isym), print.c (scm_iprin1):
	Extracted printing of ilocs and isyms to guile internal functions
	scm_i_print_iloc, scm_i_print_isym of eval.c.
2004-04-22 19:19:17 +00:00
Dirk Herrmann
434f2f7a91 Introduce scm_debug_mode_p as a replacement for scm_debug_mode and
SCM_DEBUGGINGP:

	* debug.h (scm_debug_mode_p, scm_debug_mode, SCM_DEBUGGINGP),
	eval.c (scm_debug_mode_p): Deprecated scm_debug_mode and
	SCM_DEBUGGINGP.  Provided scm_debug_mode_p instead, to have one
	single interface that also matches the naming conventions.
	Probably scm_debug_mode_p should be part of the private interface
	anyway.

	* debug.h (scm_debug_mode_p), backtrace.c (display_error_body),
	eval.c (SCM_APPLY, scm_trampoline_0, scm_trampoline_1,
	scm_trampoline_2): Change uses of scm_debug_mode or SCM_DEBUGGINGP
	to scm_debug_mode_p.


	Deprecate direct access to scm_ceval, scm_deval and scm_ceval_ptr:

	* eval.h (scm_ceval, scm_deval, scm_ceval_ptr), debug.h
	(scm_ceval_ptr): Deprecated.  Moved declaration of scm_ceval_ptr
	from debug.h to eval.h.

	* debug.h (SCM_RESET_DEBUG_MODE): Don't access scm_ceval_ptr any
	more, just leave it with setting scm_debug_mode_p, which is
	equivalent for practical purposes.

	* deprecated.h (SCM_XEVAL, SCM_XEVALCAR): Call scm_i_eval_x
	instead of *scm_ceval_ptr.  Leave all evaluating to scm_i_eval_x.

	* gdbint.c (gdb_eval): Call scm_i_eval_x instead of scm_ceval.

	* eval.c (ceval, deval, scm_ceval, scm_deval): Made scm_ceval
	static and renamed it to ceval throughout.  Provide a new exported
	but deprecated function scm_ceval as a wrapper for backwards
	compatibility.  The same is done for the deval/scm_deval pair of
	functions.

	* eval.c (CEVAL, SCM_CEVAL): Renamed SCM_CEVAL to CEVAL
	throughout.  Defined CEVAL to ceval or deval, based on compilation
	phase.

	* eval.c (SCM_XEVAL, SCM_XEVALCAR): Dispatch on scm_debug_mode_p
	to ceval and deval instead of calling *scm_ceval_ptr.

	* eval.c (dispatching_eval): New deprecated static function.

	* eval.c (scm_ceval_ptr): Initialized to dispatching_eval in order
	to emulate its old behaviour as closely as possible.


	Change the evaluator such that only expressions for which pair? is
	true are passed to CEVAL, and such that all other expressions are
	evaluated outside of CEVAL:

	* eval.c (EVAL): New, provided in analogy to EVALCAR.  Evaluate an
	expression that is assumed to be memoized already.  All but
	expressions of the form '(<form> <form> ...)' are evaluated inline
	without calling an evaluator.

	* eval.c (SCM_XEVAL, SCM_XEVALCAR, EVALCAR): Evaluate all but
	expressions of the form '(<form> <form> ...)' inline without
	calling an evaluator.

	* eval.c (scm_i_eval_x, scm_i_eval, scm_ceval, scm_deval): Handle
	the special case of unmemoized symbols passed on the top level.

	* eval.c (CEVAL): Change calls to CEVAL to EVAL, except where it
	is known that the expression passed to CEVAL is of the form
	'(<form> <form> ...)'.  Remove handling of the tc7-objects, since
	now it is known that the input expression of CEVAL is a pair.
2004-03-29 19:59:43 +00:00
Dirk Herrmann
6f81708ae0 * eval.c (s_splicing): Commented and reformulated.
(lookup_global_symbol, lookup_symbol): New static functions.

	(s_test, s_bindings, s_duplicate_bindings, s_variable): Removed.

	(try_macro_lookup, literal_p): Use lookup_symbol instead of
	creating a temporary pair for scm_lookupcar.

	(scm_unmemocar, unmemocar): Renamed scm_unmemocar to unmemocar,
	created deprecated wrapper function scm_unmemocar.

	(SCM_VALIDATE_NON_EMPTY_COMBINATION, scm_sym_else,
	scm_sym_unquote, scm_sym_uq_splicing, scm_sym_enter_frame,
	scm_sym_apply_frame, scm_sym_exit_frame, scm_sym_trace, f_apply,
	undefineds, sym_three_question_marks): Moved around without
	modifications.

	* eval.c, eval.h (scm_macroexp, scm_unmemocar): Deprecated.
2003-11-16 10:47:45 +00:00
Dirk Herrmann
328dc9a3ef * eval.c, eval.h (scm_m_expand_body, m_expand_body): Deprecated
public use of scm_m_expand_body in eval.h.  In eval.c, renamed
	scm_m_expand_body to m_expand_body and made it static.  Added
	deprecated wrapper scm_m_expand_body.

	(scm_eval_body, SCM_CEVAL, SCM_APPLY): Use m_expand_body instead
	of scm_m_expand_body.
2003-11-09 08:10:58 +00:00
Dirk Herrmann
d0624e391b * __scm.h, gc-card.c (SCM_DEBUG_DEBUGGER_SUPPORT,
SCM_DEBUG_DEBUGGING_SUPPORT): Renamed macro
	SCM_DEBUG_DEBUGGER_SUPPORT to SCM_DEBUG_DEBUGGING_SUPPORT and
	generalized it to apply not only to C level functions but also to
	scheme level functions.

	* debug.c, debug.h, eval.c (make-iloc, scm_make_iloc, iloc?,
	scm_iloc_p, dbg-make-iloc, scm_dbg_make_iloc, dbg-iloc?,
	scm_dbg_iloc_p): Moved functions scm_make_iloc, scm_iloc_p to
	eval.c, made them available under SCM_DEBUG_DEBUGGING_SUPPORT == 1
	only and renamed them to scm_dbg_make_iloc, scm_dbg_iloc_p,
	respectively.

	* deprecated.h, eval.c, eval.h (SCM_ILOC00, SCM_IDINC,
	SCM_IDSTMSK): Deprecated.  The macro definitions are moved from
	eval.h into eval.c and a copy is placed into deprecated.h.

	* eval.c, eval.h (SCM_MAKE_ILOC): Removed from eval.h and placed
	into eval.c. This definition was not part of the API in any
	officially released version of guile and thus does not need to go
	through a phase of deprecation.
2003-06-04 05:28:34 +00:00
Dirk Herrmann
e90c3a895d * deprecated.c, deprecated.h, eval.c, eval.h: Deprecated
scm_s_expression, scm_s_test, scm_s_body, scm_s_bindings,
	scm_s_variable, scm_s_clauses, scm_s_formals.  In eval.c the
	definitions are make static and renamed from scm_s_xxx to s_xxx.
	In deprecated.c the original definitions are copied.

	* deprecated.h, eval.c, eval: Deprecated SCM_EVALIM2, SCM_EVALIM,
	SCM_XEVAL and SCM_XEVALCAR.  The macro definitions are moved from
	eval.h into eval.c and a copy (slightly modified to work in user
	code) is placed into deprecated.h.

	* eval.c: Use the local static s_xxx definitions instead of the
	scm_s_xxx definitions throughout.
2003-06-02 20:54:21 +00:00
Dirk Herrmann
5bf6a6f0f3 * eval.c, eval.h, read.c, read.h (scm_sym_dot): Moved from eval to
read.  This will allow to make the definition in read.c static.
2003-05-06 20:17:26 +00:00
Dirk Herrmann
f58c472a84 * eval.c, eval.h, evalext.c, evalext.h (scm_m_undefine): Moved
from evalext to eval.  This will allow to make some of the
	definitions in eval.c static.
2003-05-06 20:05:04 +00:00
Dirk Herrmann
b0c5d67b98 * eval.c, eval.h, goops.c, goops.h (scm_m_atslot_ref,
scm_m_atslot_set_x, scm_m_atdispatch): Move the declarations and
	definitions of the special goops memoizers from goops.[ch] to
	eval.[ch].  Hmm... it seems that scm_m_atdispatch is not used
	throughout guile.
2003-04-25 16:22:47 +00:00
Dirk Herrmann
a98e8e985b * eval.h (SCM_ENTER_FRAME_HDLR, SCM_APPLY_FRAME_HDLR,
SCM_EXIT_FRAME_HDLR): Use SCM_PACK to convert data to a SCM value
	rather than casting to SCM.
2003-04-23 17:20:26 +00:00
Dirk Herrmann
5cb22e9606 * eval.c, eval.h, evalext.c, evalext.h (scm_sym_setter,
scm_m_generalized_set_x, scm_init_evalext): Move the declaration
	and definition of the memoizer for the generalized set! macro from
	evalext.[ch] to eval.[ch].  Use the SCM_SYNTAX snarfer macro to
	define the macro object.

	* eval.c, eval.h (s_set_x, scm_s_set_x, scm_m_set_x,
	scm_m_generalized_set_x): Since now scm_s_set_x is only used in
	eval.c, it is made static and renamed to s_set_x.

	* evalext.c (scm_defined_p, scm_m_undefine): Prefer !SCM_<foo>
	over SCM_N<foo>.
2003-04-20 19:18:43 +00:00
Dirk Herrmann
a44a9715eb * eval.c, root.h (scm_undefineds, SCM_NUM_PROTECTS, undefineds,
scm_init_eval): Made scm_undefineds static in eval.c, renamed it
	to undefineds and registered the object as a permanent object.

	* eval.c, eval.h (scm_f_apply, scm_init_eval): Made scm_f_apply
	static in eval.c, renamed it to f_apply and registered the object
	as a permanent object.
2003-04-20 18:08:07 +00:00
Dirk Herrmann
d0f6ceb84f * Removed uses of DEBUG_EXTENSIONS and DYNAMIC_LINKING to
fix compile errors with --disable-deprecated.
2003-04-20 07:19:38 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Rob Browning
5e5f51c37d * eval.h: fix various preprocessor usages of new public
symbols to expect 0 or 1 values rather than 1 or undefined.
i.e. change #ifdef to #if, etc.
2003-03-27 20:07:05 +00:00
Mikael Djurfeldt
756414cf2c * threads.h, threads.c: Moved futures to their own file.
* Makefile.am (libguile_la_SOURCES): Added futures.c.
(DOT_X_FILES): Added futures.x.
(DOT_DOC_FILES): Added futures.doc.
(modinclude_HEADERS): Added futures.h.

* threads.c, threads.h (scm_i_create_thread): Renamed from
create_thread and made global.

* eval.c: #include "libguile/futures.h".

* init.c: #include "futures.h"
(scm_init_guile_1): Call scm_init_futures.

* stime.c (SCM_TIME_UNITS_PER_SECOND): Renamed from CLKTCK.

* stime.h (SCM_TIME_UNITS_PER_SECOND): Definition moved here.

* eval.c, eval.h (scm_trampoline_0, scm_i_call_closure_0): New
functions.

* eval.c (scm_trampoline_1): Fixed arguments test for closures.
2003-01-23 16:04:37 +00:00
Mikael Djurfeldt
28d52ebb19 * __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): New definitions.
Simply lock a thread C API recursive mutex.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): Removed.

* eval.c: Replaced SOURCE_SECTION_START / SOURCE_SECTION_END with
direct calls to scm_rec_mutex_lock / unlock around the three calls
to scm_m_expand_body.

* eval.c, eval.h (promise_free): New function.
(scm_force): Rewritten;  Now thread-safe; Removed
SCM_DEFER/ALLOW_INTS.

* pthread-threads.h: Added partially implemented plugin interface
for recursive mutexes.  These are, for now, only intended to be
used internally within the Guile implementation.

* pthread-threads.c: New file.

* threads.c: Conditionally #include "pthread-threads.c".

* eval.c, eval.h (scm_makprom, scm_force): Rewritten to be
thread-safe;

* snarf.h (SCM_MUTEX, SCM_GLOBAL_MUTEX, SCM_REC_MUTEX,
SCM_GLOBAL_REC_MUTEX): New macros.

* eval.c, threads.c, threads.h, snarf.h: Rewrote critical section
macros---use mutexes instead.

* tags.h (SCM_IM_FUTURE): New tag.

* eval.c (scm_m_future): New primitive macro.
(SCM_CEVAL): Support futures.
(unmemocopy): Support unmemoization of futures.

* print.c (scm_isymnames): Name of future isym.
2002-12-15 14:24:34 +00:00