diff options
author | Neil Jerram <neil@ossau.uklinux.net> | 2001-11-16 15:04:17 +0000 |
---|---|---|
committer | Neil Jerram <neil@ossau.uklinux.net> | 2001-11-16 15:04:17 +0000 |
commit | 8f85c0c6c3eb8de857babc08ca6e832e8a497c44 (patch) | |
tree | bb9e336486e81b1733fc2d8c30088be6c3c01096 | |
parent | cecb4a5e9dbaebcc28f3be0a02feac4263a2cfcc (diff) | |
download | guile-8f85c0c6c3eb8de857babc08ca6e832e8a497c44.tar.gz |
* Adding C function declarations from the SCM interface to the
reference manual documentation.
49 files changed, 3570 insertions, 2271 deletions
diff --git a/doc/maint/ChangeLog b/doc/maint/ChangeLog index 17c3ddba2..37e19e73d 100644 --- a/doc/maint/ChangeLog +++ b/doc/maint/ChangeLog @@ -1,3 +1,12 @@ +2001-11-16 Neil Jerram <neil@ossau.uklinux.net> + + * guile.texi: Replaced by regenerated libguile version. + + * docstring.el (make-module-description-list): Exclude @deffn's + with category {C Function}. + (docstring-process-alist): Bind key "d" to + docstring-ediff-this-line in the docstring output buffer. + 2001-11-13 Neil Jerram <neil@ossau.uklinux.net> * guile.texi: Replaced by libguile version (after automatically diff --git a/doc/maint/docstring.el b/doc/maint/docstring.el index e0c05fa58..58d07eaa3 100644 --- a/doc/maint/docstring.el +++ b/doc/maint/docstring.el @@ -217,19 +217,22 @@ to which new docstrings should be added.") (match-end 1)))) (if (string-equal matched "@c module ") (setq module (read (current-buffer))) - (setq matched - (concat (buffer-substring (match-beginning 2) - (match-end 2)) - " " - (buffer-substring (match-beginning 3) - (match-end 3)))) - (message "Found docstring: %S: %s" module matched) - (let ((descriptions (assoc module alist))) - (setq alist - (cons (cons module (cons matched (cdr-safe descriptions))) - (if descriptions - (delete descriptions alist) - alist)))))))) + (let ((type (buffer-substring (match-beginning 2) + (match-end 2)))) + (if (string-equal type "{C Function}") + nil + (setq matched + (concat type + " " + (buffer-substring (match-beginning 3) + (match-end 3)))) + (message "Found docstring: %S: %s" module matched) + (let ((descriptions (assoc module alist))) + (setq alist + (cons (cons module (cons matched (cdr-safe descriptions))) + (if descriptions + (delete descriptions alist) + alist)))))))))) alist)) ;; Return the docstring from the specified LOCATION. LOCATION is a @@ -428,6 +431,7 @@ new snarfed docstring file.\n\n") (insert "\n") (goto-char (point-min)) + (local-set-key "d" 'docstring-ediff-this-line) ;; Popup the issues buffer. (let ((pop-up-frames t)) diff --git a/doc/maint/guile.texi b/doc/maint/guile.texi index fb07f2cba..a099e3dd7 100644 --- a/doc/maint/guile.texi +++ b/doc/maint/guile.texi @@ -1,58 +1,66 @@ @paragraphindent 0 acons -@deffn primitive acons key value alist -Adds a new key-value pair to @var{alist}. A new pair is +@deffn {Scheme Procedure} acons key value alist +@deffnx {C Function} scm_acons (key, value, alist) +Add a new key-value pair to @var{alist}. A new pair is created whose car is @var{key} and whose cdr is @var{value}, and the pair is consed onto @var{alist}, and the new list is returned. This function is @emph{not} destructive; @var{alist} is not modified. @end deffn sloppy-assq -@deffn primitive sloppy-assq key alist +@deffn {Scheme Procedure} sloppy-assq key alist +@deffnx {C Function} scm_sloppy_assq (key, alist) Behaves like @code{assq} but does not do any error checking. Recommended only for use in Guile internals. @end deffn sloppy-assv -@deffn primitive sloppy-assv key alist +@deffn {Scheme Procedure} sloppy-assv key alist +@deffnx {C Function} scm_sloppy_assv (key, alist) Behaves like @code{assv} but does not do any error checking. Recommended only for use in Guile internals. @end deffn sloppy-assoc -@deffn primitive sloppy-assoc key alist +@deffn {Scheme Procedure} sloppy-assoc key alist +@deffnx {C Function} scm_sloppy_assoc (key, alist) Behaves like @code{assoc} but does not do any error checking. Recommended only for use in Guile internals. @end deffn assq -@deffn primitive assq key alist -@deffnx primitive assv key alist -@deffnx primitive assoc key alist -Fetches the entry in @var{alist} that is associated with @var{key}. To +@deffn {Scheme Procedure} assq key alist +@deffnx {Scheme Procedure} assv key alist +@deffnx {Scheme Procedure} assoc key alist +@deffnx {C Function} scm_assq (key, alist) +Fetch the entry in @var{alist} that is associated with @var{key}. To decide whether the argument @var{key} matches a particular entry in @var{alist}, @code{assq} compares keys with @code{eq?}, @code{assv} uses @code{eqv?} and @code{assoc} uses @code{equal?}. If @var{key} cannot be found in @var{alist} (according to whichever equality -predicate is in use), then @code{#f} is returned. These functions +predicate is in use), then return @code{#f}. These functions return the entire alist entry found (i.e. both the key and the value). @end deffn assv -@deffn primitive assv key alist +@deffn {Scheme Procedure} assv key alist +@deffnx {C Function} scm_assv (key, alist) Behaves like @code{assq} but uses @code{eqv?} for key comparison. @end deffn assoc -@deffn primitive assoc key alist +@deffn {Scheme Procedure} assoc key alist +@deffnx {C Function} scm_assoc (key, alist) Behaves like @code{assq} but uses @code{equal?} for key comparison. @end deffn assq-ref -@deffn primitive assq-ref alist key -@deffnx primitive assv-ref alist key -@deffnx primitive assoc-ref alist key +@deffn {Scheme Procedure} assq-ref alist key +@deffnx {Scheme Procedure} assv-ref alist key +@deffnx {Scheme Procedure} assoc-ref alist key +@deffnx {C Function} scm_assq_ref (alist, key) Like @code{assq}, @code{assv} and @code{assoc}, except that only the value associated with @var{key} in @var{alist} is returned. These functions are equivalent to @@ -66,19 +74,22 @@ where @var{associator} is one of @code{assq}, @code{assv} or @code{assoc}. @end deffn assv-ref -@deffn primitive assv-ref alist key +@deffn {Scheme Procedure} assv-ref alist key +@deffnx {C Function} scm_assv_ref (alist, key) Behaves like @code{assq-ref} but uses @code{eqv?} for key comparison. @end deffn assoc-ref -@deffn primitive assoc-ref alist key +@deffn {Scheme Procedure} assoc-ref alist key +@deffnx {C Function} scm_assoc_ref (alist, key) Behaves like @code{assq-ref} but uses @code{equal?} for key comparison. @end deffn assq-set! -@deffn primitive assq-set! alist key val -@deffnx primitive assv-set! alist key value -@deffnx primitive assoc-set! alist key value +@deffn {Scheme Procedure} assq-set! alist key val +@deffnx {Scheme Procedure} assv-set! alist key value +@deffnx {Scheme Procedure} assoc-set! alist key value +@deffnx {C Function} scm_assq_set_x (alist, key, val) Reassociate @var{key} in @var{alist} with @var{value}: find any existing @var{alist} entry for @var{key} and associate it with the new @var{value}. If @var{alist} does not contain an entry for @var{key}, @@ -90,96 +101,113 @@ association list. @end deffn assv-set! -@deffn primitive assv-set! alist key val +@deffn {Scheme Procedure} assv-set! alist key val +@deffnx {C Function} scm_assv_set_x (alist, key, val) Behaves like @code{assq-set!} but uses @code{eqv?} for key comparison. @end deffn assoc-set! -@deffn primitive assoc-set! alist key val +@deffn {Scheme Procedure} assoc-set! alist key val +@deffnx {C Function} scm_assoc_set_x (alist, key, val) Behaves like @code{assq-set!} but uses @code{equal?} for key comparison. @end deffn assq-remove! -@deffn primitive assq-remove! alist key -@deffnx primitive assv-remove! alist key -@deffnx primitive assoc-remove! alist key +@deffn {Scheme Procedure} assq-remove! alist key +@deffnx {Scheme Procedure} assv-remove! alist key +@deffnx {Scheme Procedure} assoc-remove! alist key +@deffnx {C Function} scm_assq_remove_x (alist, key) Delete the first entry in @var{alist} associated with @var{key}, and return the resulting alist. @end deffn assv-remove! -@deffn primitive assv-remove! alist key +@deffn {Scheme Procedure} assv-remove! alist key +@deffnx {C Function} scm_assv_remove_x (alist, key) Behaves like @code{assq-remove!} but uses @code{eqv?} for key comparison. @end deffn assoc-remove! -@deffn primitive assoc-remove! alist key +@deffn {Scheme Procedure} assoc-remove! alist key +@deffnx {C Function} scm_assoc_remove_x (alist, key) Behaves like @code{assq-remove!} but uses @code{equal?} for key comparison. @end deffn make-arbiter -@deffn primitive make-arbiter name +@deffn {Scheme Procedure} make-arbiter name +@deffnx {C Function} scm_make_arbiter (name) Return an object of type arbiter and name @var{name}. Its state is initially unlocked. Arbiters are a way to achieve process synchronization. @end deffn try-arbiter -@deffn primitive try-arbiter arb +@deffn {Scheme Procedure} try-arbiter arb +@deffnx {C Function} scm_try_arbiter (arb) Return @code{#t} and lock the arbiter @var{arb} if the arbiter was unlocked. Otherwise, return @code{#f}. @end deffn release-arbiter -@deffn primitive release-arbiter arb +@deffn {Scheme Procedure} release-arbiter arb +@deffnx {C Function} scm_release_arbiter (arb) Return @code{#t} and unlock the arbiter @var{arb} if the arbiter was locked. Otherwise, return @code{#f}. @end deffn async -@deffn primitive async thunk +@deffn {Scheme Procedure} async thunk +@deffnx {C Function} scm_async (thunk) Create a new async for the procedure @var{thunk}. @end deffn system-async -@deffn primitive system-async thunk +@deffn {Scheme Procedure} system-async thunk +@deffnx {C Function} scm_system_async (thunk) Create a new async for the procedure @var{thunk}. Also add it to the system's list of active async objects. @end deffn async-mark -@deffn primitive async-mark a +@deffn {Scheme Procedure} async-mark a +@deffnx {C Function} scm_async_mark (a) Mark the async @var{a} for future execution. @end deffn system-async-mark -@deffn primitive system-async-mark a +@deffn {Scheme Procedure} system-async-mark a +@deffnx {C Function} scm_system_async_mark (a) Mark the async @var{a} for future execution. @end deffn run-asyncs -@deffn primitive run-asyncs list_of_a +@deffn {Scheme Procedure} run-asyncs list_of_a +@deffnx {C Function} scm_run_asyncs (list_of_a) Execute all thunks from the asyncs of the list @var{list_of_a}. @end deffn noop -@deffn primitive noop . args +@deffn {Scheme Procedure} noop . args +@deffnx {C Function} scm_noop (args) Do nothing. When called without arguments, return @code{#f}, otherwise return the first argument. @end deffn unmask-signals -@deffn primitive unmask-signals +@deffn {Scheme Procedure} unmask-signals +@deffnx {C Function} scm_unmask_signals () Unmask signals. The returned value is not specified. @end deffn mask-signals -@deffn primitive mask-signals +@deffn {Scheme Procedure} mask-signals +@deffnx {C Function} scm_mask_signals () Mask signals. The returned value is not specified. @end deffn display-error -@deffn primitive display-error stack port subr message args rest +@deffn {Scheme Procedure} display-error stack port subr message args rest +@deffnx {C Function} scm_display_error (stack, port, subr, message, args, rest) Display an error message to the output port @var{port}. @var{stack} is the saved stack for the error, @var{subr} is the name of the procedure in which the error occured and @@ -190,14 +218,16 @@ ignored. @end deffn display-application -@deffn primitive display-application frame [port [indent]] +@deffn {Scheme Procedure} display-application frame [port [indent]] +@deffnx {C Function} scm_display_application (frame, port, indent) Display a procedure application @var{frame} to the output port @var{port}. @var{indent} specifies the indentation of the output. @end deffn display-backtrace -@deffn primitive display-backtrace stack port [first [depth]] +@deffn {Scheme Procedure} display-backtrace stack port [first [depth]] +@deffnx {C Function} scm_display_backtrace (stack, port, first, depth) Display a backtrace to the output port @var{port}. @var{stack} is the stack to take the backtrace from, @var{first} specifies where in the stack to start and @var{depth} how much frames @@ -206,187 +236,210 @@ which means that default values will be used. @end deffn backtrace -@deffn primitive backtrace +@deffn {Scheme Procedure} backtrace +@deffnx {C Function} scm_backtrace () Display a backtrace of the stack saved by the last error to the current output port. @end deffn not -@deffn primitive not x +@deffn {Scheme Procedure} not x +@deffnx {C Function} scm_not (x) Return @code{#t} iff @var{x} is @code{#f}, else return @code{#f}. @end deffn boolean? -@deffn primitive boolean? obj +@deffn {Scheme Procedure} boolean? obj +@deffnx {C Function} scm_boolean_p (obj) Return @code{#t} iff @var{obj} is either @code{#t} or @code{#f}. @end deffn char? -@deffn primitive char? x +@deffn {Scheme Procedure} char? x +@deffnx {C Function} scm_char_p (x) Return @code{#t} iff @var{x} is a character, else @code{#f}. @end deffn char=? -@deffn primitive char=? x y +@deffn {Scheme Procedure} char=? x y Return @code{#t} iff @var{x} is the same character as @var{y}, else @code{#f}. @end deffn char<? -@deffn primitive char<? x y +@deffn {Scheme Procedure} char<? x y Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence, else @code{#f}. @end deffn char<=? -@deffn primitive char<=? x y +@deffn {Scheme Procedure} char<=? x y Return @code{#t} iff @var{x} is less than or equal to @var{y} in the ASCII sequence, else @code{#f}. @end deffn char>? -@deffn primitive char>? x y +@deffn {Scheme Procedure} char>? x y Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII sequence, else @code{#f}. @end deffn char>=? -@deffn primitive char>=? x y +@deffn {Scheme Procedure} char>=? x y Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the ASCII sequence, else @code{#f}. @end deffn char-ci=? -@deffn primitive char-ci=? x y +@deffn {Scheme Procedure} char-ci=? x y Return @code{#t} iff @var{x} is the same character as @var{y} ignoring case, else @code{#f}. @end deffn char-ci<? -@deffn primitive char-ci<? x y +@deffn {Scheme Procedure} char-ci<? x y Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence ignoring case, else @code{#f}. @end deffn char-ci<=? -@deffn primitive char-ci<=? x y +@deffn {Scheme Procedure} char-ci<=? x y Return @code{#t} iff @var{x} is less than or equal to @var{y} in the ASCII sequence ignoring case, else @code{#f}. @end deffn char-ci>? -@deffn primitive char-ci>? x y +@deffn {Scheme Procedure} char-ci>? x y Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII sequence ignoring case, else @code{#f}. @end deffn char-ci>=? -@deffn primitive char-ci>=? x y +@deffn {Scheme Procedure} char-ci>=? x y Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the ASCII sequence ignoring case, else @code{#f}. @end deffn char-alphabetic? -@deffn primitive char-alphabetic? chr +@deffn {Scheme Procedure} char-alphabetic? chr +@deffnx {C Function} scm_char_alphabetic_p (chr) Return @code{#t} iff @var{chr} is alphabetic, else @code{#f}. Alphabetic means the same thing as the isalpha C library function. @end deffn char-numeric? -@deffn primitive char-numeric? chr +@deffn {Scheme Procedure} char-numeric? chr +@deffnx {C Function} scm_char_numeric_p (chr) Return @code{#t} iff @var{chr} is numeric, else @code{#f}. Numeric means the same thing as the isdigit C library function. @end deffn char-whitespace? -@deffn primitive char-whitespace? chr +@deffn {Scheme Procedure} char-whitespace? chr +@deffnx {C Function} scm_char_whitespace_p (chr) Return @code{#t} iff @var{chr} is whitespace, else @code{#f}. Whitespace means the same thing as the isspace C library function. @end deffn char-upper-case? -@deffn primitive char-upper-case? chr +@deffn {Scheme Procedure} char-upper-case? chr +@deffnx {C Function} scm_char_upper_case_p (chr) Return @code{#t} iff @var{chr} is uppercase, else @code{#f}. Uppercase means the same thing as the isupper C library function. @end deffn char-lower-case? -@deffn primitive char-lower-case? chr +@deffn {Scheme Procedure} char-lower-case? chr +@deffnx {C Function} scm_char_lower_case_p (chr) Return @code{#t} iff @var{chr} is lowercase, else @code{#f}. Lowercase means the same thing as the islower C library function. @end deffn char-is-both? -@deffn primitive char-is-both? chr +@deffn {Scheme Procedure} char-is-both? chr +@deffnx {C Function} scm_char_is_both_p (chr) Return @code{#t} iff @var{chr} is either uppercase or lowercase, else @code{#f}. Uppercase and lowercase are as defined by the isupper and islower C library functions. @end deffn char->integer -@deffn primitive char->integer chr +@deffn {Scheme Procedure} char->integer chr +@deffnx {C Function} scm_char_to_integer (chr) Return the number corresponding to ordinal position of @var{chr} in the ASCII sequence. @end deffn integer->char -@deffn primitive integer->char n +@deffn {Scheme Procedure} integer->char n +@deffnx {C Function} scm_integer_to_char (n) Return the character at position @var{n} in the ASCII sequence. @end deffn char-upcase -@deffn primitive char-upcase chr +@deffn {Scheme Procedure} char-upcase chr +@deffnx {C Function} scm_char_upcase (chr) Return the uppercase character version of @var{chr}. @end deffn char-downcase -@deffn primitive char-downcase chr +@deffn {Scheme Procedure} char-downcase chr +@deffnx {C Function} scm_char_downcase (chr) Return the lowercase character version of @var{chr}. @end deffn debug-options-interface -@deffn primitive debug-options-interface [setting] +@deffn {Scheme Procedure} debug-options-interface [setting] +@deffnx {C Function} scm_debug_options (setting) Option interface for the debug options. Instead of using this procedure directly, use the procedures @code{debug-enable}, @code{debug-disable}, @code{debug-set!} and @var{debug-options}. @end deffn with-traps -@deffn primitive with-traps thunk +@deffn {Scheme Procedure} with-traps thunk +@deffnx {C Function} scm_with_traps (thunk) Call @var{thunk} with traps enabled. @end deffn memoized? -@deffn primitive memoized? obj +@deffn {Scheme Procedure} memoized? obj +@deffnx {C Function} scm_memoized_p (obj) Return @code{#t} if @var{obj} is memoized. @end deffn unmemoize -@deffn primitive unmemoize m +@deffn {Scheme Procedure} unmemoize m +@deffnx {C Function} scm_unmemoize (m) Unmemoize the memoized expression @var{m}, @end deffn memoized-environment -@deffn primitive memoized-environment m +@deffn {Scheme Procedure} memoized-environment m +@deffnx {C Function} scm_memoized_environment (m) Return the environment of the memoized expression @var{m}. @end deffn procedure-name -@deffn primitive procedure-name proc +@deffn {Scheme Procedure} procedure-name proc +@deffnx {C Function} scm_procedure_name (proc) Return the name of the procedure @var{proc} @end deffn procedure-source -@deffn primitive procedure-source proc +@deffn {Scheme Procedure} procedure-source proc +@deffnx {C Function} scm_procedure_source (proc) Return the source of the procedure @var{proc}. @end deffn procedure-environment -@deffn primitive procedure-environment proc +@deffn {Scheme Procedure} procedure-environment proc +@deffnx {C Function} scm_procedure_environment (proc) Return the environment of the procedure @var{proc}. @end deffn local-eval -@deffn primitive local-eval exp [env] +@deffn {Scheme Procedure} local-eval exp [env] +@deffnx {C Function} scm_local_eval (exp, env) Evaluate @var{exp} in its environment. If @var{env} is supplied, it is the environment in which to evaluate @var{exp}. Otherwise, @var{exp} must be a memoized code object (in which case, its environment @@ -394,12 +447,14 @@ is implicit). @end deffn debug-object? -@deffn primitive debug-object? obj +@deffn {Scheme Procedure} debug-object? obj +@deffnx {C Function} scm_debug_object_p (obj) Return @code{#t} if @var{obj} is a debug object. @end deffn dynamic-link -@deffn primitive dynamic-link filename +@deffn {Scheme Procedure} dynamic-link filename +@deffnx {C Function} scm_dynamic_link (filename) Open the dynamic library called @var{filename}. A library handle representing the opened library is returned; this handle should be used as the @var{dobj} argument to the following @@ -407,13 +462,15 @@ functions. @end deffn dynamic-object? -@deffn primitive dynamic-object? obj +@deffn {Scheme Procedure} dynamic-object? obj +@deffnx {C Function} scm_dynamic_object_p (obj) Return @code{#t} if @var{obj} is a dynamic library handle, or @code{#f} otherwise. @end deffn dynamic-unlink -@deffn primitive dynamic-unlink dobj +@deffn {Scheme Procedure} dynamic-unlink dobj +@deffnx {C Function} scm_dynamic_unlink (dobj) Unlink the indicated object file from the application. The argument @var{dobj} must have been obtained by a call to @code{dynamic-link}. After @code{dynamic-unlink} has been @@ -421,7 +478,8 @@ called on @var{dobj}, its content is no longer accessible. @end deffn dynamic-func -@deffn primitive dynamic-func name dobj +@deffn {Scheme Procedure} dynamic-func name dobj +@deffnx {C Function} scm_dynamic_func (name, dobj) Search the dynamic object @var{dobj} for the C function indicated by the string @var{name} and return some Scheme handle that can later be used with @code{dynamic-call} to @@ -434,7 +492,8 @@ needed or not and will add it when necessary. @end deffn dynamic-call -@deffn primitive dynamic-call func dobj +@deffn {Scheme Procedure} dynamic-call func dobj +@deffnx {C Function} scm_dynamic_call (func, dobj) Call the C function indicated by @var{func} and @var{dobj}. The function is passed no arguments and its return value is ignored. When @var{function} is something returned by @@ -450,7 +509,8 @@ Interrupts are deferred while the C function is executing (with @end deffn dynamic-args-call -@deffn primitive dynamic-args-call func dobj args +@deffn {Scheme Procedure} dynamic-args-call func dobj args +@deffnx {C Function} scm_dynamic_args_call (func, dobj, args) Call the C function indicated by @var{func} and @var{dobj}, just like @code{dynamic-call}, but pass it some arguments and return its return value. The C function is expected to take @@ -467,7 +527,8 @@ converted to a Scheme number and returned from the call to @end deffn dynamic-wind -@deffn primitive dynamic-wind in_guard thunk out_guard +@deffn {Scheme Procedure} dynamic-wind in_guard thunk out_guard +@deffnx {C Function} scm_dynamic_wind (in_guard, thunk, out_guard) All three arguments must be 0-argument procedures. @var{in_guard} is called, then @var{thunk}, then @var{out_guard}. @@ -519,26 +580,30 @@ a-cont @end deffn environment? -@deffn primitive environment? obj +@deffn {Scheme Procedure} environment? obj +@deffnx {C Function} scm_environment_p (obj) Return @code{#t} if @var{obj} is an environment, or @code{#f} otherwise. @end deffn environment-bound? -@deffn primitive environment-bound? env sym +@deffn {Scheme Procedure} environment-bound? env sym +@deffnx {C Function} scm_environment_bound_p (env, sym) Return @code{#t} if @var{sym} is bound in @var{env}, or @code{#f} otherwise. @end deffn environment-ref -@deffn primitive environment-ref env sym +@deffn {Scheme Procedure} environment-ref env sym +@deffnx {C Function} scm_environment_ref (env, sym) Return the value of the location bound to @var{sym} in @var{env}. If @var{sym} is unbound in @var{env}, signal an @code{environment:unbound} error. @end deffn environment-fold -@deffn primitive environment-fold env proc init +@deffn {Scheme Procedure} environment-fold env proc init +@deffnx {C Function} scm_environment_fold (env, proc, init) Iterate over all the bindings in @var{env}, accumulating some value. For each binding in @var{env}, apply @var{proc} to the symbol @@ -573,7 +638,8 @@ using environment-fold: @end deffn environment-define -@deffn primitive environment-define env sym val +@deffn {Scheme Procedure} environment-define env sym val +@deffnx {C Function} scm_environment_define (env, sym, val) Bind @var{sym} to a new location containing @var{val} in @var{env}. If @var{sym} is already bound to another location in @var{env} and the binding is mutable, that binding is @@ -584,7 +650,8 @@ immutable, signal an @code{environment:immutable-binding} error. @end deffn environment-undefine -@deffn primitive environment-undefine env sym +@deffn {Scheme Procedure} environment-undefine env sym +@deffnx {C Function} scm_environment_undefine (env, sym) Remove any binding for @var{sym} from @var{env}. If @var{sym} is unbound in @var{env}, do nothing. The return value is unspecified. @@ -593,7 +660,8 @@ immutable, signal an @code{environment:immutable-binding} error. @end deffn environment-set! -@deffn primitive environment-set! env sym val +@deffn {Scheme Procedure} environment-set! env sym val +@deffnx {C Function} scm_environment_set_x (env, sym, val) If @var{env} binds @var{sym} to some location, change that location's value to @var{val}. The return value is unspecified. @@ -604,7 +672,8 @@ to an immutable location, signal an @end deffn environment-cell -@deffn primitive environment-cell env sym for_write +@deffn {Scheme Procedure} environment-cell env sym for_write +@deffnx {C Function} scm_environment_cell (env, sym, for_write) Return the value cell which @var{env} binds to @var{sym}, or @code{#f} if the binding does not live in a value cell. The argument @var{for-write} indicates whether the caller @@ -620,7 +689,8 @@ re-bound to a new value cell, or becomes undefined. @end deffn environment-observe -@deffn primitive environment-observe env proc +@deffn {Scheme Procedure} environment-observe env proc +@deffnx {C Function} scm_environment_observe (env, proc) Whenever @var{env}'s bindings change, apply @var{proc} to @var{env}. This function returns an object, token, which you can pass to @@ -630,7 +700,8 @@ token is unspecified. @end deffn environment-observe-weak -@deffn primitive environment-observe-weak env proc +@deffn {Scheme Procedure} environment-observe-weak env proc +@deffnx {C Function} scm_environment_observe_weak (env, proc) This function is the same as environment-observe, except that the reference @var{env} retains to @var{proc} is a weak reference. This means that, if there are no other live, @@ -640,7 +711,8 @@ list of observing procedures. @end deffn environment-unobserve -@deffn primitive environment-unobserve token +@deffn {Scheme Procedure} environment-unobserve token +@deffnx {C Function} scm_environment_unobserve (token) Cancel the observation request which returned the value @var{token}. The return value is unspecified. If a call @code{(environment-observe env proc)} returns @@ -650,20 +722,23 @@ bindings change. @end deffn make-leaf-environment -@deffn primitive make-leaf-environment +@deffn {Scheme Procedure} make-leaf-environment +@deffnx {C Function} scm_make_leaf_environment () Create a new leaf environment, containing no bindings. All bindings and locations created in the new environment will be mutable. @end deffn leaf-environment? -@deffn primitive leaf-environment? object +@deffn {Scheme Procedure} leaf-environment? object +@deffnx {C Function} scm_leaf_environment_p (object) Return @code{#t} if object is a leaf environment, or @code{#f} otherwise. @end deffn make-eval-environment -@deffn primitive make-eval-environment local imported +@deffn {Scheme Procedure} make-eval-environment local imported +@deffnx {C Function} scm_make_eval_environment (local, imported) Return a new environment object eval whose bindings are the union of the bindings in the environments @var{local} and @var{imported}, with bindings from @var{local} taking @@ -688,33 +763,39 @@ In typical use, @var{local} will be a finite environment, and @end deffn eval-environment? -@deffn primitive eval-environment? object +@deffn {Scheme Procedure} eval-environment? object +@deffnx {C Function} scm_eval_environment_p (object) Return @code{#t} if object is an eval environment, or @code{#f} otherwise. @end deffn eval-environment-local -@deffn primitive eval-environment-local env +@deffn {Scheme Procedure} eval-environment-local env +@deffnx {C Function} scm_eval_environment_local (env) Return the local environment of eval environment @var{env}. @end deffn eval-environment-set-local! -@deffn primitive eval-environment-set-local! env local +@deffn {Scheme Procedure} eval-environment-set-local! env local +@deffnx {C Function} scm_eval_environment_set_local_x (env, local) Change @var{env}'s local environment to @var{local}. @end deffn eval-environment-imported -@deffn primitive eval-environment-imported env +@deffn {Scheme Procedure} eval-environment-imported env +@deffnx {C Function} scm_eval_environment_imported (env) Return the imported environment of eval environment @var{env}. @end deffn eval-environment-set-imported! -@deffn primitive eval-environment-set-imported! env imported +@deffn {Scheme Procedure} eval-environment-set-imported! env imported +@deffnx {C Function} scm_eval_environment_set_imported_x (env, imported) Change @var{env}'s imported environment to @var{imported}. @end deffn make-import-environment -@deffn primitive make-import-environment imports conflict_proc +@deffn {Scheme Procedure} make-import-environment imports conflict_proc +@deffnx {C Function} scm_make_import_environment (imports, conflict_proc) Return a new environment @var{imp} whose bindings are the union of the bindings from the environments in @var{imports}; @var{imports} must be a list of environments. That is, @@ -743,25 +824,29 @@ if one of its imported environments changes. @end deffn import-environment? -@deffn primitive import-environment? object +@deffn {Scheme Procedure} import-environment? object +@deffnx {C Function} scm_import_environment_p (object) Return @code{#t} if object is an import environment, or @code{#f} otherwise. @end deffn import-environment-imports -@deffn primitive import-environment-imports env +@deffn {Scheme Procedure} import-environment-imports env +@deffnx {C Function} scm_import_environment_imports (env) Return the list of environments imported by the import environment @var{env}. @end deffn import-environment-set-imports! -@deffn primitive import-environment-set-imports! env imports +@deffn {Scheme Procedure} import-environment-set-imports! env imports +@deffnx {C Function} scm_import_environment_set_imports_x (env, imports) Change @var{env}'s list of imported environments to @var{imports}, and check for conflicts. @end deffn make-export-environment -@deffn primitive make-export-environment private signature +@deffn {Scheme Procedure} make-export-environment private signature +@deffnx {C Function} scm_make_export_environment (private, signature) Return a new environment @var{exp} containing only those bindings in private whose symbols are present in @var{signature}. The @var{private} argument must be an @@ -809,33 +894,38 @@ if the bindings in private change. @end deffn export-environment? -@deffn primitive export-environment? object +@deffn {Scheme Procedure} export-environment? object +@deffnx {C Function} scm_export_environment_p (object) Return @code{#t} if object is an export environment, or @code{#f} otherwise. @end deffn export-environment-private -@deffn primitive export-environment-private env +@deffn {Scheme Procedure} export-environment-private env +@deffnx {C Function} scm_export_environment_private (env) Return the private environment of export environment @var{env}. @end deffn export-environment-set-private! -@deffn primitive export-environment-set-private! env private +@deffn {Scheme Procedure} export-environment-set-private! env private +@deffnx {C Function} scm_export_environment_set_private_x (env, private) Change the private environment of export environment @var{env}. @end deffn export-environment-signature -@deffn primitive export-environment-signature env +@deffn {Scheme Procedure} export-environment-signature env +@deffnx {C Function} scm_export_environment_signature (env) Return the signature of export environment @var{env}. @end deffn export-environment-set-signature! -@deffn primitive export-environment-set-signature! env signature +@deffn {Scheme Procedure} export-environment-set-signature! env signature +@deffnx {C Function} scm_export_environment_set_signature_x (env, signature) Change the signature of export environment @var{env}. @end deffn eq? -@deffn primitive eq? x y +@deffn {Scheme Procedure} eq? x y Return @code{#t} iff @var{x} references the same object as @var{y}. @code{eq?} is similar to @code{eqv?} except that in some cases it is capable of discerning distinctions finer than those detectable by @@ -843,7 +933,7 @@ capable of discerning distinctions finer than those detectable by @end deffn eqv? -@deffn primitive eqv? x y +@deffn {Scheme Procedure} eqv? x y The @code{eqv?} procedure defines a useful equivalence relation on objects. Briefly, it returns @code{#t} if @var{x} and @var{y} should normally be regarded as the same object. This relation is left slightly open to @@ -852,7 +942,7 @@ and inexact numbers. @end deffn equal? -@deffn primitive equal? x y +@deffn {Scheme Procedure} equal? x y Return @code{#t} iff @var{x} and @var{y} are recursively @code{eqv?} equivalent. @code{equal?} recursively compares the contents of pairs, vectors, and strings, applying @code{eqv?} on other objects such as @@ -862,7 +952,8 @@ terminate if its arguments are circular data structures. @end deffn scm-error -@deffn primitive scm-error key subr message args data +@deffn {Scheme Procedure} scm-error key subr message args data +@deffnx {C Function} scm_error_scm (key, subr, message, args, data) Raise an error with key @var{key}. @var{subr} can be a string naming the procedure associated with the error, or @code{#f}. @var{message} is the error message string, possibly containing @@ -879,13 +970,15 @@ it will usually be @code{#f}. @end deffn strerror -@deffn primitive strerror err +@deffn {Scheme Procedure} strerror err +@deffnx {C Function} scm_strerror (err) Return the Unix error message corresponding to @var{err}, which must be an integer value. @end deffn apply:nconc2last -@deffn primitive apply:nconc2last lst +@deffn {Scheme Procedure} apply:nconc2last lst +@deffnx {C Function} scm_nconc2last (lst) Given a list (@var{arg1} @dots{} @var{args}), this function conses the @var{arg1} @dots{} arguments onto the front of @var{args}, and returns the resulting list. Note that @@ -896,27 +989,31 @@ destroys its argument, so use with care. @end deffn force -@deffn primitive force x +@deffn {Scheme Procedure} force x +@deffnx {C Function} scm_force (x) If the promise @var{x} has not been computed yet, compute and return @var{x}, otherwise just return the previously computed value. @end deffn promise? -@deffn primitive promise? obj +@deffn {Scheme Procedure} promise? obj +@deffnx {C Function} scm_promise_p (obj) Return true if @var{obj} is a promise, i.e. a delayed computation (@pxref{Delayed evaluation,,,r5rs.info,The Revised^5 Report on Scheme}). @end deffn cons-source -@deffn primitive cons-source xorig x y +@deffn {Scheme Procedure} cons-source xorig x y +@deffnx {C Function} scm_cons_source (xorig, x, y) Create and return a new pair whose car and cdr are @var{x} and @var{y}. Any source properties associated with @var{xorig} are also associated with the new pair. @end deffn copy-tree -@deffn primitive copy-tree obj +@deffn {Scheme Procedure} copy-tree obj +@deffnx {C Function} scm_copy_tree (obj) Recursively copy the data tree that is bound to @var{obj}, and return a pointer to the new data structure. @code{copy-tree} recurses down the contents of both pairs and vectors (since both cons cells and vector @@ -925,44 +1022,50 @@ any other object. @end deffn primitive-eval -@deffn primitive primitive-eval exp +@deffn {Scheme Procedure} primitive-eval exp +@deffnx {C Function} scm_primitive_eval (exp) Evaluate @var{exp} in the top-level environment specified by the current module. @end deffn eval -@deffn primitive eval exp module +@deffn {Scheme Procedure} eval exp module +@deffnx {C Function} scm_eval (exp, module) Evaluate @var{exp}, a list representing a Scheme expression, in the top-level environment specified by @var{module}. -While @var{exp} is evaluated (using @var{primitive-eval}), +While @var{exp} is evaluated (using @code{primitive-eval}), @var{module} is made the current module. The current module is reset to its previous value when @var{eval} returns. @end deffn eval-options-interface -@deffn primitive eval-options-interface [setting] +@deffn {Scheme Procedure} eval-options-interface [setting] +@deffnx {C Function} scm_eval_options_interface (setting) Option interface for the evaluation options. Instead of using this procedure directly, use the procedures @code{eval-enable}, @code{eval-disable}, @code{eval-set!} and @var{eval-options}. @end deffn evaluator-traps-interface -@deffn primitive evaluator-traps-interface [setting] +@deffn {Scheme Procedure} evaluator-traps-interface [setting] +@deffnx {C Function} scm_evaluator_traps (setting) Option interface for the evaluator trap options. @end deffn defined? -@deffn primitive defined? sym [env] +@deffn {Scheme Procedure} defined? sym [env] +@deffnx {C Function} scm_definedp (sym, env) Return @code{#t} if @var{sym} is defined in the lexical environment @var{env}. When @var{env} is not specified, look in the top-level environment as defined by the current module. @end deffn map-in-order -@deffn primitive map-in-order +@deffn {Scheme Procedure} map-in-order implemented by the C function "scm_map" @end deffn load-extension -@deffn primitive load-extension lib init +@deffn {Scheme Procedure} load-extension lib init +@deffnx {C Function} scm_load_extension (lib, init) Load and initialize the extension designated by LIB and INIT. When there is no pre-registered function for LIB/INIT, this is equivalent to @@ -1000,8 +1103,9 @@ well. For example, @end deffn program-arguments -@deffn primitive program-arguments -@deffnx procedure command-line +@deffn {Scheme Procedure} program-arguments +@deffnx {Scheme Procedure} command-line +@deffnx {C Function} scm_program_arguments () Return the list of command line arguments passed to Guile, as a list of strings. The list includes the invoked program name, which is usually @code{"guile"}, but excludes switches and parameters for command line @@ -1009,7 +1113,8 @@ options like @code{-e} and @code{-l}. @end deffn make-fluid -@deffn primitive make-fluid +@deffn {Scheme Procedure} make-fluid +@deffnx {C Function} scm_make_fluid () Return a newly created fluid. Fluids are objects of a certain type (a smob) that can hold one SCM value per dynamic root. That is, modifications to this value are @@ -1020,25 +1125,29 @@ in its own dynamic root, you can use fluids for thread local storage. @end deffn fluid? -@deffn primitive fluid? obj +@deffn {Scheme Procedure} fluid? obj +@deffnx {C Function} scm_fluid_p (obj) Return @code{#t} iff @var{obj} is a fluid; otherwise, return @code{#f}. @end deffn fluid-ref -@deffn primitive fluid-ref fluid +@deffn {Scheme Procedure} fluid-ref fluid +@deffnx {C Function} scm_fluid_ref (fluid) Return the value associated with @var{fluid} in the current dynamic root. If @var{fluid} has not been set, then return @code{#f}. @end deffn fluid-set! -@deffn primitive fluid-set! fluid value +@deffn {Scheme Procedure} fluid-set! fluid value +@deffnx {C Function} scm_fluid_set_x (fluid, value) Set the value associated with @var{fluid} in the current dynamic root. @end deffn with-fluids* -@deffn primitive with-fluids* fluids values thunk +@deffn {Scheme Procedure} with-fluids* fluids values thunk +@deffnx {C Function} scm_with_fluids (fluids, values, thunk) Set @var{fluids} to @var{values} temporary, and call @var{thunk}. @var{fluids} must be a list of fluids and @var{values} must be the same number of their values to be applied. Each substitution is done @@ -1046,7 +1155,8 @@ one after another. @var{thunk} must be a procedure with no argument. @end deffn setvbuf -@deffn primitive setvbuf port mode [size] +@deffn {Scheme Procedure} setvbuf port mode [size] +@deffnx {C Function} scm_setvbuf (port, mode, size) Set the buffering mode for @var{port}. @var{mode} can be: @table @code @item _IONBF @@ -1060,12 +1170,14 @@ If @var{size} is omitted, a default size will be used. @end deffn file-port? -@deffn primitive file-port? obj +@deffn {Scheme Procedure} file-port? obj +@deffnx {C Function} scm_file_port_p (obj) Determine whether @var{obj} is a port that is related to a file. @end deffn open-file -@deffn primitive open-file filename mode +@deffn {Scheme Procedure} open-file filename mode +@deffnx {C Function} scm_open_file (filename, mode) Open the file whose name is @var{filename}, and return a port representing that file. The attributes of the port are determined by the @var{mode} string. The way in which this is @@ -1106,32 +1218,37 @@ requested, @code{open-file} throws an exception. @end deffn gc-stats -@deffn primitive gc-stats +@deffn {Scheme Procedure} gc-stats +@deffnx {C Function} scm_gc_stats () Return an association list of statistics about Guile's current use of storage. @end deffn object-address -@deffn primitive object-address obj +@deffn {Scheme Procedure} object-address obj +@deffnx {C Function} scm_object_address (obj) Return an integer that for the lifetime of @var{obj} is uniquely returned by this function for @var{obj} @end deffn gc -@deffn primitive gc +@deffn {Scheme Procedure} gc +@deffnx {C Function} scm_gc () Scans all of SCM objects and reclaims for further use those that are no longer accessible. @end deffn %compute-slots -@deffn primitive %compute-slots class +@deffn {Scheme Procedure} %compute-slots class +@deffnx {C Function} scm_sys_compute_slots (class) Return a list consisting of the names of all slots belonging to class @var{class}, i. e. the slots of @var{class} and of all of its superclasses. @end deffn get-keyword -@deffn primitive get-keyword key l default_value +@deffn {Scheme Procedure} get-keyword key l default_value +@deffnx {C Function} scm_get_keyword (key, l, default_value) Determine an associated value for the keyword @var{key} from the list @var{l}. The list @var{l} has to consist of an even number of elements, where, starting with the first, every @@ -1141,246 +1258,293 @@ If @var{l} does not hold a value for @var{key}, the value @end deffn %initialize-object -@deffn primitive %initialize-object obj initargs +@deffn {Scheme Procedure} %initialize-object obj initargs +@deffnx {C Function} scm_sys_initialize_object (obj, initargs) Initialize the object @var{obj} with the given arguments @var{initargs}. @end deffn %prep-layout! -@deffn primitive %prep-layout! class +@deffn {Scheme Procedure} %prep-layout! class +@deffnx {C Function} scm_sys_prep_layout_x (class) @end deffn %inherit-magic! -@deffn primitive %inherit-magic! class dsupers +@deffn {Scheme Procedure} %inherit-magic! class dsupers +@deffnx {C Function} scm_sys_inherit_magic_x (class, dsupers) @end deffn instance? -@deffn primitive instance? obj +@deffn {Scheme Procedure} instance? obj +@deffnx {C Function} scm_instance_p (obj) Return @code{#t} if @var{obj} is an instance. @end deffn class-name -@deffn primitive class-name obj +@deffn {Scheme Procedure} class-name obj +@deffnx {C Function} scm_class_name (obj) Return the class name of @var{obj}. @end deffn class-direct-supers -@deffn primitive class-direct-supers obj +@deffn {Scheme Procedure} class-direct-supers obj +@deffnx {C Function} scm_class_direct_supers (obj) Return the direct superclasses of the class @var{obj}. @end deffn class-direct-slots -@deffn primitive class-direct-slots obj +@deffn {Scheme Procedure} class-direct-slots obj +@deffnx {C Function} scm_class_direct_slots (obj) Return the direct slots of the class @var{obj}. @end deffn class-direct-subclasses -@deffn primitive class-direct-subclasses obj +@deffn {Scheme Procedure} class-direct-subclasses obj +@deffnx {C Function} scm_class_direct_subclasses (obj) Return the direct subclasses of the class @var{obj}. @end deffn class-direct-methods -@deffn primitive class-direct-methods obj +@deffn {Scheme Procedure} class-direct-methods obj +@deffnx {C Function} scm_class_direct_methods (obj) Return the direct methods of the class @var{obj} @end deffn class-precedence-list -@deffn primitive class-precedence-list obj +@deffn {Scheme Procedure} class-precedence-list obj +@deffnx {C Function} scm_class_precedence_list (obj) Return the class precedence list of the class @var{obj}. @end deffn class-slots -@deffn primitive class-slots obj +@deffn {Scheme Procedure} class-slots obj +@deffnx {C Function} scm_class_slots (obj) Return the slot list of the class @var{obj}. @end deffn class-environment -@deffn primitive class-environment obj +@deffn {Scheme Procedure} class-environment obj +@deffnx {C Function} scm_class_environment (obj) Return the environment of the class @var{obj}. @end deffn generic-function-name -@deffn primitive generic-function-name obj +@deffn {Scheme Procedure} generic-function-name obj +@deffnx {C Function} scm_generic_function_name (obj) Return the name of the generic function @var{obj}. @end deffn generic-function-methods -@deffn primitive generic-function-methods obj +@deffn {Scheme Procedure} generic-function-methods obj +@deffnx {C Function} scm_generic_function_methods (obj) Return the methods of the generic function @var{obj}. @end deffn method-generic-function -@deffn primitive method-generic-function obj +@deffn {Scheme Procedure} method-generic-function obj +@deffnx {C Function} scm_method_generic_function (obj) Return the generic function fot the method @var{obj}. @end deffn method-specializers -@deffn primitive method-specializers obj +@deffn {Scheme Procedure} method-specializers obj +@deffnx {C Function} scm_method_specializers (obj) Return specializers of the method @var{obj}. @end deffn method-procedure -@deffn primitive method-procedure obj +@deffn {Scheme Procedure} method-procedure obj +@deffnx {C Function} scm_method_procedure (obj) Return the procedure of the method @var{obj}. @end deffn accessor-method-slot-definition -@deffn primitive accessor-method-slot-definition obj +@deffn {Scheme Procedure} accessor-method-slot-definition obj +@deffnx {C Function} scm_accessor_method_slot_definition (obj) Return the slot definition of the accessor @var{obj}. @end deffn %tag-body -@deffn primitive %tag-body body +@deffn {Scheme Procedure} %tag-body body +@deffnx {C Function} scm_sys_tag_body (body) Internal GOOPS magic---don't use this function! @end deffn make-unbound -@deffn primitive make-unbound +@deffn {Scheme Procedure} make-unbound +@deffnx {C Function} scm_make_unbound () Return the unbound value. @end deffn unbound? -@deffn primitive unbound? obj +@deffn {Scheme Procedure} unbound? obj +@deffnx {C Function} scm_unbound_p (obj) Return @code{#t} if @var{obj} is unbound. @end deffn assert-bound -@deffn primitive assert-bound value obj +@deffn {Scheme Procedure} assert-bound value obj +@deffnx {C Function} scm_assert_bound (value, obj) Return @var{value} if it is bound, and invoke the @var{slot-unbound} method of @var{obj} if it is not. @end deffn @@assert-bound-ref -@deffn primitive @@assert-bound-ref obj index +@deffn {Scheme Procedure} @@assert-bound-ref obj index +@deffnx {C Function} scm_at_assert_bound_ref (obj, index) Like @code{assert-bound}, but use @var{index} for accessing the value from @var{obj}. @end deffn %fast-slot-ref -@deffn primitive %fast-slot-ref obj index +@deffn {Scheme Procedure} %fast-slot-ref obj index +@deffnx {C Function} scm_sys_fast_slot_ref (obj, index) Return the slot value with index @var{index} from @var{obj}. @end deffn %fast-slot-set! -@deffn primitive %fast-slot-set! obj index value +@deffn {Scheme Procedure} %fast-slot-set! obj index value +@deffnx {C Function} scm_sys_fast_slot_set_x (obj, index, value) Set the slot with index @var{index} in @var{obj} to @var{value}. @end deffn slot-ref-using-class -@deffn primitive slot-ref-using-class class obj slot_name +@deffn {Scheme Procedure} slot-ref-using-class class obj slot_name +@deffnx {C Function} scm_slot_ref_using_class (class, obj, slot_name) @end deffn slot-set-using-class! -@deffn primitive slot-set-using-class! class obj slot_name value +@deffn {Scheme Procedure} slot-set-using-class! class obj slot_name value +@deffnx {C Function} scm_slot_set_using_class_x (class, obj, slot_name, value) @end deffn slot-bound-using-class? -@deffn primitive slot-bound-using-class? class obj slot_name +@deffn {Scheme Procedure} slot-bound-using-class? class obj slot_name +@deffnx {C Function} scm_slot_bound_using_class_p (class, obj, slot_name) @end deffn slot-exists-using-class? -@deffn primitive slot-exists-using-class? class obj slot_name +@deffn {Scheme Procedure} slot-exists-using-class? class obj slot_name +@deffnx {C Function} scm_slot_exists_using_class_p (class, obj, slot_name) @end deffn slot-ref -@deffn primitive slot-ref obj slot_name +@deffn {Scheme Procedure} slot-ref obj slot_name +@deffnx {C Function} scm_slot_ref (obj, slot_name) Return the value from @var{obj}'s slot with the name @var{slot_name}. @end deffn slot-set! -@deffn primitive slot-set! obj slot_name value +@deffn {Scheme Procedure} slot-set! obj slot_name value +@deffnx {C Function} scm_slot_set_x (obj, slot_name, value) Set the slot named @var{slot_name} of @var{obj} to @var{value}. @end deffn slot-bound? -@deffn primitive slot-bound? obj slot_name +@deffn {Scheme Procedure} slot-bound? obj slot_name +@deffnx {C Function} scm_slot_bound_p (obj, slot_name) Return @code{#t} if the slot named @var{slot_name} of @var{obj} is bound. @end deffn slot-exists? -@deffn primitive slot-exists? obj slot_name +@deffn {Scheme Procedure} slot-exists? obj slot_name +@deffnx {C Function} scm_slots_exists_p (obj, slot_name) Return @code{#t} if @var{obj} has a slot named @var{slot_name}. @end deffn %allocate-instance -@deffn primitive %allocate-instance class initargs +@deffn {Scheme Procedure} %allocate-instance class initargs +@deffnx {C Function} scm_sys_allocate_instance (class, initargs) Create a new instance of class @var{class} and initialize it from the arguments @var{initargs}. @end deffn %set-object-setter! -@deffn primitive %set-object-setter! obj setter +@deffn {Scheme Procedure} %set-object-setter! obj setter +@deffnx {C Function} scm_sys_set_object_setter_x (obj, setter) @end deffn %modify-instance -@deffn primitive %modify-instance old new +@deffn {Scheme Procedure} %modify-instance old new +@deffnx {C Function} scm_sys_modify_instance (old, new) @end deffn %modify-class -@deffn primitive %modify-class old new +@deffn {Scheme Procedure} %modify-class old new +@deffnx {C Function} scm_sys_modify_class (old, new) @end deffn %invalidate-class -@deffn primitive %invalidate-class class +@deffn {Scheme Procedure} %invalidate-class class +@deffnx {C Function} scm_sys_invalidate_class (class) @end deffn %invalidate-method-cache! -@deffn primitive %invalidate-method-cache! gf +@deffn {Scheme Procedure} %invalidate-method-cache! gf +@deffnx {C Function} scm_sys_invalidate_method_cache_x (gf) @end deffn generic-capability? -@deffn primitive generic-capability? proc +@deffn {Scheme Procedure} generic-capability? proc +@deffnx {C Function} scm_generic_capability_p (proc) @end deffn enable-primitive-generic! -@deffn primitive enable-primitive-generic! . subrs +@deffn {Scheme Procedure} enable-primitive-generic! . subrs +@deffnx {C Function} scm_enable_primitive_generic_x (subrs) @end deffn primitive-generic-generic -@deffn primitive primitive-generic-generic subr +@deffn {Scheme Procedure} primitive-generic-generic subr +@deffnx {C Function} scm_primitive_generic_generic (subr) @end deffn make -@deffn primitive make . args +@deffn {Scheme Procedure} make . args +@deffnx {C Function} scm_make (args) Make a new object. @var{args} must contain the class and all necessary initialization information. @end deffn find-method -@deffn primitive find-method . l +@deffn {Scheme Procedure} find-method . l +@deffnx {C Function} scm_find_method (l) @end deffn %method-more-specific? -@deffn primitive %method-more-specific? m1 m2 targs +@deffn {Scheme Procedure} %method-more-specific? m1 m2 targs +@deffnx {C Function} scm_sys_method_more_specific_p (m1, m2, targs) @end deffn %goops-loaded -@deffn primitive %goops-loaded +@deffn {Scheme Procedure} %goops-loaded +@deffnx {C Function} scm_sys_goops_loaded () Announce that GOOPS is loaded and perform initialization on the C level which depends on the loaded GOOPS modules. @end deffn make-guardian -@deffn primitive make-guardian [greedy_p] +@deffn {Scheme Procedure} make-guardian [greedy_p] +@deffnx {C Function} scm_make_guardian (greedy_p) Create a new guardian. A guardian protects a set of objects from garbage collection, allowing a program to apply cleanup or other actions. @@ -1409,24 +1573,28 @@ paper still (mostly) accurately describes the interface). @end deffn guardian-destroyed? -@deffn primitive guardian-destroyed? guardian +@deffn {Scheme Procedure} guardian-destroyed? guardian +@deffnx {C Function} scm_guardian_destroyed_p (guardian) Return @code{#t} if @var{guardian} has been destroyed, otherwise @code{#f}. @end deffn guardian-greedy? -@deffn primitive guardian-greedy? guardian +@deffn {Scheme Procedure} guardian-greedy? guardian +@deffnx {C Function} scm_guardian_greedy_p (guardian) Return @code{#t} if @var{guardian} is a greedy guardian, otherwise @code{#f}. @end deffn destroy-guardian! -@deffn primitive destroy-guardian! guardian +@deffn {Scheme Procedure} destroy-guardian! guardian +@deffnx {C Function} scm_destroy_guardian_x (guardian) Destroys @var{guardian}, by making it impossible to put any more objects in it or get any objects from it. It also unguards any objects guarded by @var{guardian}. @end deffn hashq -@deffn primitive hashq key size +@deffn {Scheme Procedure} hashq key size +@deffnx {C Function} scm_hashq (key, size) Determine a hash value for @var{key} that is suitable for lookups in a hashtable of size @var{size}, where @code{eq?} is used as the equality predicate. The function returns an @@ -1440,7 +1608,8 @@ different values, since @code{foo} will be garbage collected. @end deffn hashv -@deffn primitive hashv key size +@deffn {Scheme Procedure} hashv key size +@deffnx {C Function} scm_hashv (key, size) Determine a hash value for @var{key} that is suitable for lookups in a hashtable of size @var{size}, where @code{eqv?} is used as the equality predicate. The function returns an @@ -1454,7 +1623,8 @@ different values, since @code{foo} will be garbage collected. @end deffn hash -@deffn primitive hash key size +@deffn {Scheme Procedure} hash key size +@deffnx {C Function} scm_hash (key, size) Determine a hash value for @var{key} that is suitable for lookups in a hashtable of size @var{size}, where @code{equal?} is used as the equality predicate. The function returns an @@ -1462,7 +1632,8 @@ integer in the range 0 to @var{size} - 1. @end deffn hashq-get-handle -@deffn primitive hashq-get-handle table key +@deffn {Scheme Procedure} hashq-get-handle table key +@deffnx {C Function} scm_hashq_get_handle (table, key) This procedure returns the @code{(key . value)} pair from the hash table @var{table}. If @var{table} does not hold an associated value for @var{key}, @code{#f} is returned. @@ -1470,14 +1641,16 @@ Uses @code{eq?} for equality testing. @end deffn hashq-create-handle! -@deffn primitive hashq-create-handle! table key init +@deffn {Scheme Procedure} hashq-create-handle! table key init +@deffnx {C Function} scm_hashq_create_handle_x (table, key, init) This function looks up @var{key} in @var{table} and returns its handle. If @var{key} is not already present, a new handle is created which associates @var{key} with @var{init}. @end deffn hashq-ref -@deffn primitive hashq-ref table key [dflt] +@deffn {Scheme Procedure} hashq-ref table key [dflt] +@deffnx {C Function} scm_hashq_ref (table, key, dflt) Look up @var{key} in the hash table @var{table}, and return the value (if any) associated with it. If @var{key} is not found, return @var{default} (or @code{#f} if no @var{default} argument @@ -1485,19 +1658,22 @@ is supplied). Uses @code{eq?} for equality testing. @end deffn hashq-set! -@deffn primitive hashq-set! table key val +@deffn {Scheme Procedure} hashq-set! table key val +@deffnx {C Function} scm_hashq_set_x (table, key, val) Find the entry in @var{table} associated with @var{key}, and store @var{value} there. Uses @code{eq?} for equality testing. @end deffn hashq-remove! -@deffn primitive hashq-remove! table key +@deffn {Scheme Procedure} hashq-remove! table key +@deffnx {C Function} scm_hashq_remove_x (table, key) Remove @var{key} (and any value associated with it) from @var{table}. Uses @code{eq?} for equality tests. @end deffn hashv-get-handle -@deffn primitive hashv-get-handle table key +@deffn {Scheme Procedure} hashv-get-handle table key +@deffnx {C Function} scm_hashv_get_handle (table, key) This procedure returns the @code{(key . value)} pair from the hash table @var{table}. If @var{table} does not hold an associated value for @var{key}, @code{#f} is returned. @@ -1505,14 +1681,16 @@ Uses @code{eqv?} for equality testing. @end deffn hashv-create-handle! -@deffn primitive hashv-create-handle! table key init +@deffn {Scheme Procedure} hashv-create-handle! table key init +@deffnx {C Function} scm_hashv_create_handle_x (table, key, init) This function looks up @var{key} in @var{table} and returns its handle. If @var{key} is not already present, a new handle is created which associates @var{key} with @var{init}. @end deffn hashv-ref -@deffn primitive hashv-ref table key [dflt] +@deffn {Scheme Procedure} hashv-ref table key [dflt] +@deffnx {C Function} scm_hashv_ref (table, key, dflt) Look up @var{key} in the hash table @var{table}, and return the value (if any) associated with it. If @var{key} is not found, return @var{default} (or @code{#f} if no @var{default} argument @@ -1520,19 +1698,22 @@ is supplied). Uses @code{eqv?} for equality testing. @end deffn hashv-set! -@deffn primitive hashv-set! table key val +@deffn {Scheme Procedure} hashv-set! table key val +@deffnx {C Function} scm_hashv_set_x (table, key, val) Find the entry in @var{table} associated with @var{key}, and store @var{value} there. Uses @code{eqv?} for equality testing. @end deffn hashv-remove! -@deffn primitive hashv-remove! table key +@deffn {Scheme Procedure} hashv-remove! table key +@deffnx {C Function} scm_hashv_remove_x (table, key) Remove @var{key} (and any value associated with it) from @var{table}. Uses @code{eqv?} for equality tests. @end deffn hash-get-handle -@deffn primitive hash-get-handle table key +@deffn {Scheme Procedure} hash-get-handle table key +@deffnx {C Function} scm_hash_get_handle (table, key) This procedure returns the @code{(key . value)} pair from the hash table @var{table}. If @var{table} does not hold an associated value for @var{key}, @code{#f} is returned. @@ -1540,14 +1721,16 @@ Uses @code{equal?} for equality testing. @end deffn hash-create-handle! -@deffn primitive hash-create-handle! table key init +@deffn {Scheme Procedure} hash-create-handle! table key init +@deffnx {C Function} scm_hash_create_handle_x (table, key, init) This function looks up @var{key} in @var{table} and returns its handle. If @var{key} is not already present, a new handle is created which associates @var{key} with @var{init}. @end deffn hash-ref -@deffn primitive hash-ref table key [dflt] +@deffn {Scheme Procedure} hash-ref table key [dflt] +@deffnx {C Function} scm_hash_ref (table, key, dflt) Look up @var{key} in the hash table @var{table}, and return the value (if any) associated with it. If @var{key} is not found, return @var{default} (or @code{#f} if no @var{default} argument @@ -1555,20 +1738,23 @@ is supplied). Uses @code{equal?} for equality testing. @end deffn hash-set! -@deffn primitive hash-set! table key val +@deffn {Scheme Procedure} hash-set! table key val +@deffnx {C Function} scm_hash_set_x (table, key, val) Find the entry in @var{table} associated with @var{key}, and store @var{value} there. Uses @code{equal?} for equality testing. @end deffn hash-remove! -@deffn primitive hash-remove! table key +@deffn {Scheme Procedure} hash-remove! table key +@deffnx {C Function} scm_hash_remove_x (table, key) Remove @var{key} (and any value associated with it) from @var{table}. Uses @code{equal?} for equality tests. @end deffn hashx-get-handle -@deffn primitive hashx-get-handle hash assoc table key +@deffn {Scheme Procedure} hashx-get-handle hash assoc table key +@deffnx {C Function} scm_hashx_get_handle (hash, assoc, table, key) This behaves the same way as the corresponding @code{-get-handle} function, but uses @var{hash} as a hash function and @var{assoc} to compare keys. @code{hash} must be @@ -1578,7 +1764,8 @@ table size. @code{assoc} must be an associator function, like @end deffn hashx-create-handle! -@deffn primitive hashx-create-handle! hash assoc table key init +@deffn {Scheme Procedure} hashx-create-handle! hash assoc table key init +@deffnx {C Function} scm_hashx_create_handle_x (hash, assoc, table, key, init) This behaves the same way as the corresponding @code{-create-handle} function, but uses @var{hash} as a hash function and @var{assoc} to compare keys. @code{hash} must be @@ -1588,7 +1775,8 @@ table size. @code{assoc} must be an associator function, like @end deffn hashx-ref -@deffn primitive hashx-ref hash assoc table key [dflt] +@deffn {Scheme Procedure} hashx-ref hash assoc table key [dflt] +@deffnx {C Function} scm_hashx_ref (hash, assoc, table, key, dflt) This behaves the same way as the corresponding @code{ref} function, but uses @var{hash} as a hash function and @var{assoc} to compare keys. @code{hash} must be a function @@ -1601,7 +1789,8 @@ equivalent to @code{hashx-ref hashq assq table key}. @end deffn hashx-set! -@deffn primitive hashx-set! hash assoc table key val +@deffn {Scheme Procedure} hashx-set! hash assoc table key val +@deffnx {C Function} scm_hashx_set_x (hash, assoc, table, key, val) This behaves the same way as the corresponding @code{set!} function, but uses @var{hash} as a hash function and @var{assoc} to compare keys. @code{hash} must be a function @@ -1614,7 +1803,8 @@ equivalent to @code{hashx-set! hashq assq table key}. @end deffn hash-fold -@deffn primitive hash-fold proc init table +@deffn {Scheme Procedure} hash-fold proc init table +@deffnx {C Function} scm_hash_fold (proc, init, table) An iterator over hash-table elements. Accumulates and returns a result by applying PROC successively. The arguments to PROC are "(key value prior-result)" where key @@ -1626,25 +1816,29 @@ table into an a-list of key-value pairs. @end deffn make-hook -@deffn primitive make-hook [n_args] +@deffn {Scheme Procedure} make-hook [n_args] +@deffnx {C Function} scm_make_hook (n_args) Create a hook for storing procedure of arity @var{n_args}. @var{n_args} defaults to zero. The returned value is a hook object to be used with the other hook procedures. @end deffn hook? -@deffn primitive hook? x +@deffn {Scheme Procedure} hook? x +@deffnx {C Function} scm_hook_p (x) Return @code{#t} if @var{x} is a hook, @code{#f} otherwise. @end deffn hook-empty? -@deffn primitive hook-empty? hook +@deffn {Scheme Procedure} hook-empty? hook +@deffnx {C Function} scm_hook_empty_p (hook) Return @code{#t} if @var{hook} is an empty hook, @code{#f} otherwise. @end deffn add-hook! -@deffn primitive add-hook! hook proc [append_p] +@deffn {Scheme Procedure} add-hook! hook proc [append_p] +@deffnx {C Function} scm_add_hook_x (hook, proc, append_p) Add the procedure @var{proc} to the hook @var{hook}. The procedure is added to the end if @var{append_p} is true, otherwise it is added to the front. The return value of this @@ -1652,31 +1846,36 @@ procedure is not specified. @end deffn remove-hook! -@deffn primitive remove-hook! hook proc +@deffn {Scheme Procedure} remove-hook! hook proc +@deffnx {C Function} scm_remove_hook_x (hook, proc) Remove the procedure @var{proc} from the hook @var{hook}. The return value of this procedure is not specified. @end deffn reset-hook! -@deffn primitive reset-hook! hook +@deffn {Scheme Procedure} reset-hook! hook +@deffnx {C Function} scm_reset_hook_x (hook) Remove all procedures from the hook @var{hook}. The return value of this procedure is not specified. @end deffn run-hook -@deffn primitive run-hook hook . args +@deffn {Scheme Procedure} run-hook hook . args +@deffnx {C Function} scm_run_hook (hook, args) Apply all procedures from the hook @var{hook} to the arguments @var{args}. The order of the procedure application is first to last. The return value of this procedure is not specified. @end deffn hook->list -@deffn primitive hook->list hook +@deffn {Scheme Procedure} hook->list hook +@deffnx {C Function} scm_hook_to_list (hook) Convert the procedure list of @var{hook} to a list. @end deffn ftell -@deffn primitive ftell fd_port +@deffn {Scheme Procedure} ftell fd_port +@deffnx {C Function} scm_ftell (fd_port) Return an integer representing the current position of @var{fd/port}, measured from the beginning. Equivalent to: @@ -1686,7 +1885,8 @@ Return an integer representing the current position of @end deffn redirect-port -@deffn primitive redirect-port old new +@deffn {Scheme Procedure} redirect-port old new +@deffnx {C Function} scm_redirect_port (old, new) This procedure takes two ports and duplicates the underlying file descriptor from @var{old-port} into @var{new-port}. The current file descriptor in @var{new-port} will be closed. @@ -1703,14 +1903,16 @@ revealed counts. @end deffn dup->fdes -@deffn primitive dup->fdes fd_or_port [fd] +@deffn {Scheme Procedure} dup->fdes fd_or_port [fd] +@deffnx {C Function} scm_dup_to_fdes (fd_or_port, fd) Return a new integer file descriptor referring to the open file designated by @var{fd_or_port}, which must be either an open file port or a file descriptor. @end deffn dup2 -@deffn primitive dup2 oldfd newfd +@deffn {Scheme Procedure} dup2 oldfd newfd +@deffnx {C Function} scm_dup2 (oldfd, newfd) A simple wrapper for the @code{dup2} system call. Copies the file descriptor @var{oldfd} to descriptor number @var{newfd}, replacing the previous meaning @@ -1722,19 +1924,22 @@ The return value is unspecified. @end deffn fileno -@deffn primitive fileno port +@deffn {Scheme Procedure} fileno port +@deffnx {C Function} scm_fileno (port) Return the integer file descriptor underlying @var{port}. Does not change its revealed count. @end deffn isatty? -@deffn primitive isatty? port +@deffn {Scheme Procedure} isatty? port +@deffnx {C Function} scm_isatty_p (port) Return @code{#t} if @var{port} is using a serial non--file device, otherwise @code{#f}. @end deffn fdopen -@deffn primitive fdopen fdes modes +@deffn {Scheme Procedure} fdopen fdes modes +@deffnx {C Function} scm_fdopen (fdes, modes) Return a new port based on the file descriptor @var{fdes}. Modes are given by the string @var{modes}. The revealed count of the port is initialized to zero. The modes string is the @@ -1742,7 +1947,8 @@ same as that accepted by @ref{File Ports, open-file}. @end deffn primitive-move->fdes -@deffn primitive primitive-move->fdes port fd +@deffn {Scheme Procedure} primitive-move->fdes port fd +@deffnx {C Function} scm_primitive_move_to_fdes (port, fd) Moves the underlying file descriptor for @var{port} to the integer value @var{fdes} without changing the revealed count of @var{port}. Any other ports already using this descriptor will be automatically @@ -1752,68 +1958,78 @@ required value or @code{#t} if it was moved. @end deffn fdes->ports -@deffn primitive fdes->ports fd +@deffn {Scheme Procedure} fdes->ports fd +@deffnx {C Function} scm_fdes_to_ports (fd) Return a list of existing ports which have @var{fdes} as an underlying file descriptor, without changing their revealed counts. @end deffn make-keyword-from-dash-symbol -@deffn primitive make-keyword-from-dash-symbol symbol +@deffn {Scheme Procedure} make-keyword-from-dash-symbol symbol +@deffnx {C Function} scm_make_keyword_from_dash_symbol (symbol) Make a keyword object from a @var{symbol} that starts with a dash. @end deffn keyword? -@deffn primitive keyword? obj +@deffn {Scheme Procedure} keyword? obj +@deffnx {C Function} scm_keyword_p (obj) Return @code{#t} if the argument @var{obj} is a keyword, else @code{#f}. @end deffn keyword-dash-symbol -@deffn primitive keyword-dash-symbol keyword +@deffn {Scheme Procedure} keyword-dash-symbol keyword +@deffnx {C Function} scm_keyword_dash_symbol (keyword) Return the dash symbol for @var{keyword}. This is the inverse of @code{make-keyword-from-dash-symbol}. @end deffn nil-cons -@deffn primitive nil-cons x y +@deffn {Scheme Procedure} nil-cons x y +@deffnx {C Function} scm_nil_cons (x, y) Create a new cons cell with @var{x} as the car and @var{y} as the cdr, but convert @var{y} to Scheme's end-of-list if it is a LISP nil. @end deffn nil-car -@deffn primitive nil-car x +@deffn {Scheme Procedure} nil-car x +@deffnx {C Function} scm_nil_car (x) Return the car of @var{x}, but convert it to LISP nil if it is Scheme's end-of-list. @end deffn nil-cdr -@deffn primitive nil-cdr x +@deffn {Scheme Procedure} nil-cdr x +@deffnx {C Function} scm_nil_cdr (x) Return the cdr of @var{x}, but convert it to LISP nil if it is Scheme's end-of-list. @end deffn null -@deffn primitive null x +@deffn {Scheme Procedure} null x +@deffnx {C Function} scm_null (x) Return LISP's @code{t} if @var{x} is nil in the LISP sense, return LISP's nil otherwise. @end deffn nil-eq -@deffn primitive nil-eq x y +@deffn {Scheme Procedure} nil-eq x y Compare @var{x} and @var{y} and return LISP's t if they are @code{eq?}, return LISP's nil otherwise. @end deffn list -@deffn primitive list . objs +@deffn {Scheme Procedure} list . objs +@deffnx {C Function} scm_list (objs) Return a list containing @var{objs}, the arguments to @code{list}. @end deffn cons* -@deffn primitive cons* arg . rest +@deffn {Scheme Procedure} cons* arg . rest +@deffnx {C Function} scm_cons_star (arg, rest) Like @code{list}, but the last arg provides the tail of the constructed list, returning @code{(cons @var{arg1} (cons @var{arg2} (cons @dots{} @var{argn})))}. Requires at least one @@ -1823,22 +2039,26 @@ Schemes and in Common LISP. @end deffn null? -@deffn primitive null? x +@deffn {Scheme Procedure} null? x +@deffnx {C Function} scm_null_p (x) Return @code{#t} iff @var{x} is the empty list, else @code{#f}. @end deffn list? -@deffn primitive list? x +@deffn {Scheme Procedure} list? x +@deffnx {C Function} scm_list_p (x) Return @code{#t} iff @var{x} is a proper list, else @code{#f}. @end deffn length -@deffn primitive length lst +@deffn {Scheme Procedure} length lst +@deffnx {C Function} scm_length (lst) Return the number of elements in list @var{lst}. @end deffn append -@deffn primitive append . args +@deffn {Scheme Procedure} append . args +@deffnx {C Function} scm_append (args) Return a list consisting of the elements the lists passed as arguments. @lisp @@ -1857,7 +2077,8 @@ if the last argument is not a proper list. @end deffn append! -@deffn primitive append! . lists +@deffn {Scheme Procedure} append! . lists +@deffnx {C Function} scm_append_x (lists) A destructive version of @code{append} (@pxref{Pairs and Lists,,,r5rs, The Revised^5 Report on Scheme}). The cdr field of each list's final pair is changed to point to the head of @@ -1866,19 +2087,22 @@ the mutated list. @end deffn last-pair -@deffn primitive last-pair lst +@deffn {Scheme Procedure} last-pair lst +@deffnx {C Function} scm_last_pair (lst) Return a pointer to the last pair in @var{lst}, signalling an error if @var{lst} is circular. @end deffn reverse -@deffn primitive reverse lst +@deffn {Scheme Procedure} reverse lst +@deffnx {C Function} scm_reverse (lst) Return a new list that contains the elements of @var{lst} but in reverse order. @end deffn reverse! -@deffn primitive reverse! lst [new_tail] +@deffn {Scheme Procedure} reverse! lst [new_tail] +@deffnx {C Function} scm_reverse_x (lst, new_tail) A destructive version of @code{reverse} (@pxref{Pairs and Lists,,,r5rs, The Revised^5 Report on Scheme}). The cdr of each cell in @var{lst} is modified to point to the previous list element. Return a pointer to the @@ -1893,23 +2117,26 @@ of the modified list is not lost, it is wise to save the return value of @end deffn list-ref -@deffn primitive list-ref list k +@deffn {Scheme Procedure} list-ref list k +@deffnx {C Function} scm_list_ref (list, k) Return the @var{k}th element from @var{list}. @end deffn list-set! -@deffn primitive list-set! list k val +@deffn {Scheme Procedure} list-set! list k val +@deffnx {C Function} scm_list_set_x (list, k, val) Set the @var{k}th element of @var{list} to @var{val}. @end deffn list-cdr-ref -@deffn primitive list-cdr-ref +@deffn {Scheme Procedure} list-cdr-ref implemented by the C function "scm_list_tail" @end deffn list-tail -@deffn primitive list-tail lst k -@deffnx primitive list-cdr-ref lst k +@deffn {Scheme Procedure} list-tail lst k +@deffnx {Scheme Procedure} list-cdr-ref lst k +@deffnx {C Function} scm_list_tail (lst, k) Return the "tail" of @var{lst} beginning with its @var{k}th element. The first element of the list is considered to be element 0. @@ -1919,23 +2146,27 @@ or returning the results of cdring @var{k} times down @var{lst}. @end deffn list-cdr-set! -@deffn primitive list-cdr-set! list k val +@deffn {Scheme Procedure} list-cdr-set! list k val +@deffnx {C Function} scm_list_cdr_set_x (list, k, val) Set the @var{k}th cdr of @var{list} to @var{val}. @end deffn list-head -@deffn primitive list-head lst k +@deffn {Scheme Procedure} list-head lst k +@deffnx {C Function} scm_list_head (lst, k) Copy the first @var{k} elements from @var{lst} into a new list, and return it. @end deffn list-copy -@deffn primitive list-copy lst +@deffn {Scheme Procedure} list-copy lst +@deffnx {C Function} scm_list_copy (lst) Return a (newly-created) copy of @var{lst}. @end deffn memq -@deffn primitive memq x lst +@deffn {Scheme Procedure} memq x lst +@deffnx {C Function} scm_memq (x, lst) Return the first sublist of @var{lst} whose car is @code{eq?} to @var{x} where the sublists of @var{lst} are the non-empty lists returned by @code{(list-tail @var{lst} @var{k})} for @@ -1945,7 +2176,8 @@ returned. @end deffn memv -@deffn primitive memv x lst +@deffn {Scheme Procedure} memv x lst +@deffnx {C Function} scm_memv (x, lst) Return the first sublist of @var{lst} whose car is @code{eqv?} to @var{x} where the sublists of @var{lst} are the non-empty lists returned by @code{(list-tail @var{lst} @var{k})} for @@ -1955,7 +2187,8 @@ returned. @end deffn member -@deffn primitive member x lst +@deffn {Scheme Procedure} member x lst +@deffnx {C Function} scm_member (x, lst) Return the first sublist of @var{lst} whose car is @code{equal?} to @var{x} where the sublists of @var{lst} are the non-empty lists returned by @code{(list-tail @var{lst} @@ -1965,9 +2198,10 @@ empty list) is returned. @end deffn delq! -@deffn primitive delq! item lst -@deffnx primitive delv! item lst -@deffnx primitive delete! item lst +@deffn {Scheme Procedure} delq! item lst +@deffnx {Scheme Procedure} delv! item lst +@deffnx {Scheme Procedure} delete! item lst +@deffnx {C Function} scm_delq_x (item, lst) These procedures are destructive versions of @code{delq}, @code{delv} and @code{delete}: they modify the pointers in the existing @var{lst} rather than creating a new list. Caveat evaluator: Like other @@ -1977,19 +2211,22 @@ destructive list functions, these functions cannot modify the binding of @end deffn delv! -@deffn primitive delv! item lst +@deffn {Scheme Procedure} delv! item lst +@deffnx {C Function} scm_delv_x (item, lst) Destructively remove all elements from @var{lst} that are @code{eqv?} to @var{item}. @end deffn delete! -@deffn primitive delete! item lst +@deffn {Scheme Procedure} delete! item lst +@deffnx {C Function} scm_delete_x (item, lst) Destructively remove all elements from @var{lst} that are @code{equal?} to @var{item}. @end deffn delq -@deffn primitive delq item lst +@deffn {Scheme Procedure} delq item lst +@deffnx {C Function} scm_delq (item, lst) Return a newly-created copy of @var{lst} with elements @code{eq?} to @var{item} removed. This procedure mirrors @code{memq}: @code{delq} compares elements of @var{lst} against @@ -1997,7 +2234,8 @@ Return a newly-created copy of @var{lst} with elements @end deffn delv -@deffn primitive delv item lst +@deffn {Scheme Procedure} delv item lst +@deffnx {C Function} scm_delv (item, lst) Return a newly-created copy of @var{lst} with elements @code{eqv?} to @var{item} removed. This procedure mirrors @code{memv}: @code{delv} compares elements of @var{lst} against @@ -2005,7 +2243,8 @@ Return a newly-created copy of @var{lst} with elements @end deffn delete -@deffn primitive delete item lst +@deffn {Scheme Procedure} delete item lst +@deffnx {C Function} scm_delete (item, lst) Return a newly-created copy of @var{lst} with elements @code{equal?} to @var{item} removed. This procedure mirrors @code{member}: @code{delete} compares elements of @var{lst} @@ -2013,28 +2252,32 @@ against @var{item} with @code{equal?}. @end deffn delq1! -@deffn primitive delq1! item lst +@deffn {Scheme Procedure} delq1! item lst +@deffnx {C Function} scm_delq1_x (item, lst) Like @code{delq!}, but only deletes the first occurrence of @var{item} from @var{lst}. Tests for equality using @code{eq?}. See also @code{delv1!} and @code{delete1!}. @end deffn delv1! -@deffn primitive delv1! item lst +@deffn {Scheme Procedure} delv1! item lst +@deffnx {C Function} scm_delv1_x (item, lst) Like @code{delv!}, but only deletes the first occurrence of @var{item} from @var{lst}. Tests for equality using @code{eqv?}. See also @code{delq1!} and @code{delete1!}. @end deffn delete1! -@deffn primitive delete1! item lst +@deffn {Scheme Procedure} delete1! item lst +@deffnx {C Function} scm_delete1_x (item, lst) Like @code{delete!}, but only deletes the first occurrence of @var{item} from @var{lst}. Tests for equality using @code{equal?}. See also @code{delq1!} and @code{delv1!}. @end deffn primitive-load -@deffn primitive primitive-load filename +@deffn {Scheme Procedure} primitive-load filename +@deffnx {C Function} scm_primitive_load (filename) Load the file named @var{filename} and evaluate its contents in the top-level environment. The load paths are not searched; @var{filename} must either be a full pathname or be a pathname @@ -2045,26 +2288,30 @@ documentation for @code{%load-hook} later in this section. @end deffn %package-data-dir -@deffn primitive %package-data-dir +@deffn {Scheme Procedure} %package-data-dir +@deffnx {C Function} scm_sys_package_data_dir () Return the name of the directory where Scheme packages, modules and libraries are kept. On most Unix systems, this will be @samp{/usr/local/share/guile}. @end deffn %library-dir -@deffn primitive %library-dir +@deffn {Scheme Procedure} %library-dir +@deffnx {C Function} scm_sys_library_dir () Return the directory where the Guile Scheme library files are installed. E.g., may return "/usr/share/guile/1.3.5". @end deffn %site-dir -@deffn primitive %site-dir +@deffn {Scheme Procedure} %site-dir +@deffnx {C Function} scm_sys_site_dir () Return the directory where the Guile site files are installed. E.g., may return "/usr/share/guile/site". @end deffn parse-path -@deffn primitive parse-path path [tail] +@deffn {Scheme Procedure} parse-path path [tail] +@deffnx {C Function} scm_parse_path (path, tail) Parse @var{path}, which is expected to be a colon-separated string, into a list and return the resulting list with @var{tail} appended. If @var{path} is @code{#f}, @var{tail} @@ -2072,7 +2319,8 @@ is returned. @end deffn search-path -@deffn primitive search-path path filename [extensions] +@deffn {Scheme Procedure} search-path path filename [extensions] +@deffnx {C Function} scm_search_path (path, filename, extensions) Search @var{path} for a directory containing a file named @var{filename}. The file must be readable, and not a directory. If we find one, return its full filename; otherwise, return @@ -2083,7 +2331,8 @@ concatenated with each @var{extension}. @end deffn %search-load-path -@deffn primitive %search-load-path filename +@deffn {Scheme Procedure} %search-load-path filename +@deffnx {C Function} scm_sys_search_load_path (filename) Search @var{%load-path} for the file named @var{filename}, which must be readable by the current user. If @var{filename} is found in the list of paths to search or is an absolute @@ -2094,7 +2343,8 @@ will try each extension automatically. @end deffn primitive-load-path -@deffn primitive primitive-load-path filename +@deffn {Scheme Procedure} primitive-load-path filename +@deffnx {C Function} scm_primitive_load_path (filename) Search @var{%load-path} for the file named @var{filename} and load it into the top-level environment. If @var{filename} is a relative pathname and is not found in the list of search paths, @@ -2102,7 +2352,8 @@ an error is signalled. @end deffn procedure->syntax -@deffn primitive procedure->syntax code +@deffn {Scheme Procedure} procedure->syntax code +@deffnx {C Function} scm_makacro (code) Return a @dfn{macro} which, when a symbol defined to this value appears as the first symbol in an expression, returns the result of applying @var{code} to the expression and the @@ -2110,7 +2361,8 @@ environment. @end deffn procedure->macro -@deffn primitive procedure->macro code +@deffn {Scheme Procedure} procedure->macro code +@deffnx {C Function} scm_makmacro (code) Return a @dfn{macro} which, when a symbol defined to this value appears as the first symbol in an expression, evaluates the result of applying @var{code} to the expression and the @@ -2128,7 +2380,8 @@ passed to @var{code}. For example: @end deffn procedure->memoizing-macro -@deffn primitive procedure->memoizing-macro code +@deffn {Scheme Procedure} procedure->memoizing-macro code +@deffnx {C Function} scm_makmmacro (code) Return a @dfn{macro} which, when a symbol defined to this value appears as the first symbol in an expression, evaluates the result of applying @var{proc} to the expression and the @@ -2146,43 +2399,50 @@ passed to @var{proc}. For example: @end deffn macro? -@deffn primitive macro? obj +@deffn {Scheme Procedure} macro? obj +@deffnx {C Function} scm_macro_p (obj) Return @code{#t} if @var{obj} is a regular macro, a memoizing macro or a syntax transformer. @end deffn macro-type -@deffn primitive macro-type m +@deffn {Scheme Procedure} macro-type m +@deffnx {C Function} scm_macro_type (m) Return one of the symbols @code{syntax}, @code{macro} or @code{macro!}, depending on whether @var{m} is a syntax -tranformer, a regular macro, or a memoizing macro, +transformer, a regular macro, or a memoizing macro, respectively. If @var{m} is not a macro, @code{#f} is returned. @end deffn macro-name -@deffn primitive macro-name m +@deffn {Scheme Procedure} macro-name m +@deffnx {C Function} scm_macro_name (m) Return the name of the macro @var{m}. @end deffn macro-transformer -@deffn primitive macro-transformer m +@deffn {Scheme Procedure} macro-transformer m +@deffnx {C Function} scm_macro_transformer (m) Return the transformer of the macro @var{m}. @end deffn current-module -@deffn primitive current-module +@deffn {Scheme Procedure} current-module +@deffnx {C Function} scm_current_module () Return the current module. @end deffn set-current-module -@deffn primitive set-current-module module +@deffn {Scheme Procedure} set-current-module module +@deffnx {C Function} scm_set_current_module (module) Set the current module to @var{module} and return the previous current module. @end deffn interaction-environment -@deffn primitive interaction-environment +@deffn {Scheme Procedure} interaction-environment +@deffnx {C Function} scm_interaction_environment () Return a specifier for the environment that contains implementation--defined bindings, typically a superset of those listed in the report. The intent is that this procedure will @@ -2191,45 +2451,52 @@ evaluate expressions dynamically typed by the user. @end deffn env-module -@deffn primitive env-module env +@deffn {Scheme Procedure} env-module env +@deffnx {C Function} scm_env_module (env) Return the module of @var{ENV}, a lexical environment. @end deffn standard-eval-closure -@deffn primitive standard-eval-closure module +@deffn {Scheme Procedure} standard-eval-closure module +@deffnx {C Function} scm_standard_eval_closure (module) Return an eval closure for the module @var{module}. @end deffn standard-interface-eval-closure -@deffn primitive standard-interface-eval-closure module +@deffn {Scheme Procedure} standard-interface-eval-closure module +@deffnx {C Function} scm_standard_interface_eval_closure (module) Return a interface eval closure for the module @var{module}. Such a closure does not allow new bindings to be added. @end deffn %get-pre-modules-obarray -@deffn primitive %get-pre-modules-obarray +@deffn {Scheme Procedure} %get-pre-modules-obarray +@deffnx {C Function} scm_get_pre_modules_obarray () Return the obarray that is used for all new bindings before the module system is booted. The first call to @code{set-current-module} will boot the module system. @end deffn exact? -@deffn primitive exact? x +@deffn {Scheme Procedure} exact? x +@deffnx {C Function} scm_exact_p (x) Return @code{#t} if @var{x} is an exact number, @code{#f} otherwise. @end deffn odd? -@deffn primitive odd? n +@deffn {Scheme Procedure} odd? n +@deffnx {C Function} scm_odd_p (n) Return @code{#t} if @var{n} is an odd number, @code{#f} otherwise. @end deffn even? -@deffn primitive even? n +@deffn {Scheme Procedure} even? n +@deffnx {C Function} scm_even_p (n) Return @code{#t} if @var{n} is an even number, @code{#f} otherwise. @end deffn logand -@deffn primitive logand n1 n2 +@deffn {Scheme Procedure} logand n1 n2 Return the bitwise AND of the integer arguments. @lisp @@ -2240,7 +2507,7 @@ Return the bitwise AND of the integer arguments. @end deffn logior -@deffn primitive logior n1 n2 +@deffn {Scheme Procedure} logior n1 n2 Return the bitwise OR of the integer arguments. @lisp @@ -2251,7 +2518,7 @@ Return the bitwise OR of the integer arguments. @end deffn logxor -@deffn primitive logxor n1 n2 +@deffn {Scheme Procedure} logxor n1 n2 Return the bitwise XOR of the integer arguments. A bit is set in the result if it is set in an odd number of arguments. @lisp @@ -2263,7 +2530,8 @@ set in the result if it is set in an odd number of arguments. @end deffn logtest -@deffn primitive logtest j k +@deffn {Scheme Procedure} logtest j k +@deffnx {C Function} scm_logtest (j, k) @lisp (logtest j k) @equiv{} (not (zero? (logand j k))) @@ -2273,7 +2541,8 @@ set in the result if it is set in an odd number of arguments. @end deffn logbit? -@deffn primitive logbit? index j +@deffn {Scheme Procedure} logbit? index j +@deffnx {C Function} scm_logbit_p (index, j) @lisp (logbit? index j) @equiv{} (logtest (integer-expt 2 index) j) @@ -2286,7 +2555,8 @@ set in the result if it is set in an odd number of arguments. @end deffn lognot -@deffn primitive lognot n +@deffn {Scheme Procedure} lognot n +@deffnx {C Function} scm_lognot (n) Return the integer which is the 2s-complement of the integer argument. @@ -2299,7 +2569,8 @@ argument. @end deffn integer-expt -@deffn primitive integer-expt n k +@deffn {Scheme Procedure} integer-expt n k +@deffnx {C Function} scm_integer_expt (n, k) Return @var{n} raised to the non-negative integer exponent @var{k}. @@ -2312,7 +2583,8 @@ Return @var{n} raised to the non-negative integer exponent @end deffn ash -@deffn primitive ash n cnt +@deffn {Scheme Procedure} ash n cnt +@deffnx {C Function} scm_ash (n, cnt) The function ash performs an arithmetic shift left by @var{cnt} bits (or shift right, if @var{cnt} is negative). 'Arithmetic' means, that the function does not guarantee to keep the bit @@ -2331,7 +2603,8 @@ Formally, the function returns an integer equivalent to @end deffn bit-extract -@deffn primitive bit-extract n start end +@deffn {Scheme Procedure} bit-extract n start end +@deffnx {C Function} scm_bit_extract (n, start, end) Return the integer composed of the @var{start} (inclusive) through @var{end} (exclusive) bits of @var{n}. The @var{start}th bit becomes the 0-th bit in the result. @@ -2345,7 +2618,8 @@ through @var{end} (exclusive) bits of @var{n}. The @end deffn logcount -@deffn primitive logcount n +@deffn {Scheme Procedure} logcount n +@deffnx {C Function} scm_logcount (n) Return the number of bits in integer @var{n}. If integer is positive, the 1-bits in its binary representation are counted. If negative, the 0-bits in its two's-complement binary @@ -2362,7 +2636,8 @@ representation are counted. If 0, 0 is returned. @end deffn integer-length -@deffn primitive integer-length n +@deffn {Scheme Procedure} integer-length n +@deffnx {C Function} scm_integer_length (n) Return the number of bits neccessary to represent @var{n}. @lisp @@ -2376,14 +2651,16 @@ Return the number of bits neccessary to represent @var{n}. @end deffn number->string -@deffn primitive number->string n [radix] +@deffn {Scheme Procedure} number->string n [radix] +@deffnx {C Function} scm_number_to_string (n, radix) Return a string holding the external representation of the number @var{n} in the given @var{radix}. If @var{n} is inexact, a radix of 10 will be used. @end deffn string->number -@deffn primitive string->number string [radix] +@deffn {Scheme Procedure} string->number string [radix] +@deffnx {C Function} scm_string_to_number (string, radix) Return a number of the maximally precise representation expressed by the given @var{string}. @var{radix} must be an exact integer, either 2, 8, 10, or 16. If supplied, @var{radix} @@ -2395,12 +2672,13 @@ syntactically valid notation for a number, then @end deffn number? -@deffn primitive number? +@deffn {Scheme Procedure} number? implemented by the C function "scm_number_p" @end deffn complex? -@deffn primitive complex? x +@deffn {Scheme Procedure} complex? x +@deffnx {C Function} scm_number_p (x) Return @code{#t} if @var{x} is a complex number, @code{#f} else. Note that the sets of real, rational and integer values form subsets of the set of complex numbers, i. e. the @@ -2409,12 +2687,13 @@ rational or integer number. @end deffn real? -@deffn primitive real? +@deffn {Scheme Procedure} real? implemented by the C function "scm_real_p" @end deffn rational? -@deffn primitive rational? x +@deffn {Scheme Procedure} rational? x +@deffnx {C Function} scm_real_p (x) Return @code{#t} if @var{x} is a rational number, @code{#f} else. Note that the set of integer values forms a subset of the set of rational numbers, i. e. the predicate will also be @@ -2424,25 +2703,29 @@ precision. @end deffn integer? -@deffn primitive integer? x +@deffn {Scheme Procedure} integer? x +@deffnx {C Function} scm_integer_p (x) Return @code{#t} if @var{x} is an integer number, @code{#f} else. @end deffn inexact? -@deffn primitive inexact? x +@deffn {Scheme Procedure} inexact? x +@deffnx {C Function} scm_inexact_p (x) Return @code{#t} if @var{x} is an inexact number, @code{#f} else. @end deffn $expt -@deffn primitive $expt x y +@deffn {Scheme Procedure} $expt x y +@deffnx {C Function} scm_sys_expt (x, y) Return @var{x} raised to the power of @var{y}. This procedure does not accept complex arguments. @end deffn $atan2 -@deffn primitive $atan2 x y +@deffn {Scheme Procedure} $atan2 x y +@deffnx {C Function} scm_sys_atan2 (x, y) Return the arc tangent of the two arguments @var{x} and @var{y}. This is similar to calculating the arc tangent of @var{x} / @var{y}, except that the signs of both arguments @@ -2451,111 +2734,126 @@ procedure does not accept complex arguments. @end deffn make-rectangular -@deffn primitive make-rectangular real imaginary +@deffn {Scheme Procedure} make-rectangular real imaginary +@deffnx {C Function} scm_make_rectangular (real, imaginary) Return a complex number constructed of the given @var{real} and @var{imaginary} parts. @end deffn make-polar -@deffn primitive make-polar x y +@deffn {Scheme Procedure} make-polar x y +@deffnx {C Function} scm_make_polar (x, y) Return the complex number @var{x} * e^(i * @var{y}). @end deffn inexact->exact -@deffn primitive inexact->exact z +@deffn {Scheme Procedure} inexact->exact z +@deffnx {C Function} scm_inexact_to_exact (z) Return an exact number that is numerically closest to @var{z}. @end deffn class-of -@deffn primitive class-of x +@deffn {Scheme Procedure} class-of x +@deffnx {C Function} scm_class_of (x) Return the class of @var{x}. @end deffn entity? -@deffn primitive entity? obj +@deffn {Scheme Procedure} entity? obj +@deffnx {C Function} scm_entity_p (obj) Return @code{#t} if @var{obj} is an entity. @end deffn operator? -@deffn primitive operator? obj +@deffn {Scheme Procedure} operator? obj +@deffnx {C Function} scm_operator_p (obj) Return @code{#t} if @var{obj} is an operator. @end deffn valid-object-procedure? -@deffn primitive valid-object-procedure? proc +@deffn {Scheme Procedure} valid-object-procedure? proc +@deffnx {C Function} scm_valid_object_procedure_p (proc) Return @code{#t} iff @var{proc} is a procedure that can be used with @code{set-object-procedure}. It is always valid to use a closure constructed by @code{lambda}. @end deffn set-object-procedure! -@deffn primitive set-object-procedure! obj proc +@deffn {Scheme Procedure} set-object-procedure! obj proc +@deffnx {C Function} scm_set_object_procedure_x (obj, proc) Set the object procedure of @var{obj} to @var{proc}. @var{obj} must be either an entity or an operator. @end deffn make-class-object -@deffn primitive make-class-object metaclass layout +@deffn {Scheme Procedure} make-class-object metaclass layout +@deffnx {C Function} scm_make_class_object (metaclass, layout) Create a new class object of class @var{metaclass}, with the slot layout specified by @var{layout}. @end deffn make-subclass-object -@deffn primitive make-subclass-object class layout +@deffn {Scheme Procedure} make-subclass-object class layout +@deffnx {C Function} scm_make_subclass_object (class, layout) Create a subclass object of @var{class}, with the slot layout specified by @var{layout}. @end deffn object-properties -@deffn primitive object-properties obj -@deffnx primitive procedure-properties obj +@deffn {Scheme Procedure} object-properties obj +@deffnx {C Function} scm_object_properties (obj) Return @var{obj}'s property list. @end deffn set-object-properties! -@deffn primitive set-object-properties! obj alist -@deffnx primitive set-procedure-properties! obj alist +@deffn {Scheme Procedure} set-object-properties! obj alist +@deffnx {C Function} scm_set_object_properties_x (obj, alist) Set @var{obj}'s property list to @var{alist}. @end deffn object-property -@deffn primitive object-property obj key -@deffnx primitive procedure-property obj key +@deffn {Scheme Procedure} object-property obj key +@deffnx {C Function} scm_object_property (obj, key) Return the property of @var{obj} with name @var{key}. @end deffn set-object-property! -@deffn primitive set-object-property! obj key value -@deffnx primitive set-procedure-property! obj key value +@deffn {Scheme Procedure} set-object-property! obj key value +@deffnx {C Function} scm_set_object_property_x (obj, key, value) In @var{obj}'s property list, set the property named @var{key} to @var{value}. @end deffn cons -@deffn primitive cons x y +@deffn {Scheme Procedure} cons x y +@deffnx {C Function} scm_cons (x, y) Return a newly allocated pair whose car is @var{x} and whose cdr is @var{y}. The pair is guaranteed to be different (in the sense of @code{eq?}) from every previously existing object. @end deffn pair? -@deffn primitive pair? x +@deffn {Scheme Procedure} pair? x +@deffnx {C Function} scm_pair_p (x) Return @code{#t} if @var{x} is a pair; otherwise return @code{#f}. @end deffn set-car! -@deffn primitive set-car! pair value +@deffn {Scheme Procedure} set-car! pair value +@deffnx {C Function} scm_set_car_x (pair, value) Stores @var{value} in the car field of @var{pair}. The value returned by @code{set-car!} is unspecified. @end deffn set-cdr! -@deffn primitive set-cdr! pair value +@deffn {Scheme Procedure} set-cdr! pair value +@deffnx {C Function} scm_set_cdr_x (pair, value) Stores @var{value} in the cdr field of @var{pair}. The value returned by @code{set-cdr!} is unspecified. @end deffn char-ready? -@deffn primitive char-ready? [port] +@deffn {Scheme Procedure} char-ready? [port] +@deffnx {C Function} scm_char_ready_p (port) Return @code{#t} if a character is ready on input @var{port} and return @code{#f} otherwise. If @code{char-ready?} returns @code{#t} then the next @code{read-char} operation on @@ -2572,7 +2870,8 @@ interactive port that has no ready characters.} @end deffn drain-input -@deffn primitive drain-input port +@deffn {Scheme Procedure} drain-input port +@deffnx {C Function} scm_drain_input (port) This procedure clears a port's input buffers, similar to the way that force-output clears the output buffer. The contents of the buffers are returned as a single string, e.g., @@ -2590,14 +2889,16 @@ for further input. @end deffn current-input-port -@deffn primitive current-input-port +@deffn {Scheme Procedure} current-input-port +@deffnx {C Function} scm_current_input_port () Return the current input port. This is the default port used by many input procedures. Initially, @code{current-input-port} returns the @dfn{standard input} in Unix and C terminology. @end deffn current-output-port -@deffn primitive current-output-port +@deffn {Scheme Procedure} current-output-port +@deffnx {C Function} scm_current_output_port () Return the current output port. This is the default port used by many output procedures. Initially, @code{current-output-port} returns the @dfn{standard output} in @@ -2605,49 +2906,57 @@ Unix and C terminology. @end deffn current-error-port -@deffn primitive current-error-port +@deffn {Scheme Procedure} current-error-port +@deffnx {C Function} scm_current_error_port () Return the port to which errors and warnings should be sent (the @dfn{standard error} in Unix and C terminology). @end deffn current-load-port -@deffn primitive current-load-port +@deffn {Scheme Procedure} current-load-port +@deffnx {C Function} scm_current_load_port () Return the current-load-port. The load port is used internally by @code{primitive-load}. @end deffn set-current-input-port -@deffn primitive set-current-input-port port -@deffnx primitive set-current-output-port port -@deffnx primitive set-current-error-port port +@deffn {Scheme Procedure} set-current-input-port port +@deffnx {Scheme Procedure} set-current-output-port port +@deffnx {Scheme Procedure} set-current-error-port port +@deffnx {C Function} scm_set_current_input_port (port) Change the ports returned by @code{current-input-port}, @code{current-output-port} and @code{current-error-port}, respectively, so that they use the supplied @var{port} for input or output. @end deffn set-current-output-port -@deffn primitive set-current-output-port port +@deffn {Scheme Procedure} set-current-output-port port +@deffnx {C Function} scm_set_current_output_port (port) Set the current default output port to @var{port}. @end deffn set-current-error-port -@deffn primitive set-current-error-port port +@deffn {Scheme Procedure} set-current-error-port port +@deffnx {C Function} scm_set_current_error_port (port) Set the current default error port to @var{port}. @end deffn port-revealed -@deffn primitive port-revealed port +@deffn {Scheme Procedure} port-revealed port +@deffnx {C Function} scm_port_revealed (port) Return the revealed count for @var{port}. @end deffn set-port-revealed! -@deffn primitive set-port-revealed! port rcount +@deffn {Scheme Procedure} set-port-revealed! port rcount +@deffnx {C Function} scm_set_port_revealed_x (port, rcount) Sets the revealed count for a port to a given value. The return value is unspecified. @end deffn port-mode -@deffn primitive port-mode port +@deffn {Scheme Procedure} port-mode port +@deffnx {C Function} scm_port_mode (port) Return the port modes associated with the open port @var{port}. These will not necessarily be identical to the modes used when the port was opened, since modes such as "append" which are @@ -2655,7 +2964,8 @@ used only during port creation are not retained. @end deffn close-port -@deffn primitive close-port port +@deffn {Scheme Procedure} close-port port +@deffnx {C Function} scm_close_port (port) Close the specified port object. Return @code{#t} if it successfully closes a port or @code{#f} if it was already closed. An exception may be raised if an error occurs, for @@ -2665,7 +2975,8 @@ descriptors. @end deffn close-input-port -@deffn primitive close-input-port port +@deffn {Scheme Procedure} close-input-port port +@deffnx {C Function} scm_close_input_port (port) Close the specified input port object. The routine has no effect if the file has already been closed. An exception may be raised if an error occurs. The value returned is unspecified. @@ -2675,7 +2986,8 @@ which can close file descriptors. @end deffn close-output-port -@deffn primitive close-output-port port +@deffn {Scheme Procedure} close-output-port port +@deffnx {C Function} scm_close_output_port (port) Close the specified output port object. The routine has no effect if the file has already been closed. An exception may be raised if an error occurs. The value returned is unspecified. @@ -2685,7 +2997,8 @@ which can close file descriptors. @end deffn port-for-each -@deffn primitive port-for-each proc +@deffn {Scheme Procedure} port-for-each proc +@deffnx {C Function} scm_port_for_each (proc) Apply @var{proc} to each port in the Guile port table in turn. The return value is unspecified. More specifically, @var{proc} is applied exactly once to every port that exists @@ -2695,40 +3008,46 @@ have no effect as far as @var{port-for-each} is concerned. @end deffn input-port? -@deffn primitive input-port? x +@deffn {Scheme Procedure} input-port? x +@deffnx {C Function} scm_input_port_p (x) Return @code{#t} if @var{x} is an input port, otherwise return @code{#f}. Any object satisfying this predicate also satisfies @code{port?}. @end deffn output-port? -@deffn primitive output-port? x +@deffn {Scheme Procedure} output-port? x +@deffnx {C Function} scm_output_port_p (x) Return @code{#t} if @var{x} is an output port, otherwise return @code{#f}. Any object satisfying this predicate also satisfies @code{port?}. @end deffn port? -@deffn primitive port? x +@deffn {Scheme Procedure} port? x +@deffnx {C Function} scm_port_p (x) Return a boolean indicating whether @var{x} is a port. Equivalent to @code{(or (input-port? @var{x}) (output-port? @var{x}))}. @end deffn port-closed? -@deffn primitive port-closed? port +@deffn {Scheme Procedure} port-closed? port +@deffnx {C Function} scm_port_closed_p (port) Return @code{#t} if @var{port} is closed or @code{#f} if it is open. @end deffn eof-object? -@deffn primitive eof-object? x +@deffn {Scheme Procedure} eof-object? x +@deffnx {C Function} scm_eof_object_p (x) Return @code{#t} if @var{x} is an end-of-file object; otherwise return @code{#f}. @end deffn force-output -@deffn primitive force-output [port] +@deffn {Scheme Procedure} force-output [port] +@deffnx {C Function} scm_force_output (port) Flush the specified output port, or the current output port if @var{port} is omitted. The current output buffer contents are passed to the underlying port implementation (e.g., in the case of fports, the @@ -2739,20 +3058,23 @@ The return value is unspecified. @end deffn flush-all-ports -@deffn primitive flush-all-ports +@deffn {Scheme Procedure} flush-all-ports +@deffnx {C Function} scm_flush_all_ports () Equivalent to calling @code{force-output} on all open output ports. The return value is unspecified. @end deffn read-char -@deffn primitive read-char [port] +@deffn {Scheme Procedure} read-char [port] +@deffnx {C Function} scm_read_char (port) Return the next character available from @var{port}, updating @var{port} to point to the following character. If no more characters are available, the end-of-file object is returned. @end deffn peek-char -@deffn primitive peek-char [port] +@deffn {Scheme Procedure} peek-char [port] +@deffnx {C Function} scm_peek_char (port) Return the next character available from @var{port}, @emph{without} updating @var{port} to point to the following character. If no more characters are available, the @@ -2768,7 +3090,8 @@ to @code{read-char} would have hung.} @end deffn unread-char -@deffn primitive unread-char cobj [port] +@deffn {Scheme Procedure} unread-char cobj [port] +@deffnx {C Function} scm_unread_char (cobj, port) Place @var{char} in @var{port} so that it will be read by the next read operation. If called multiple times, the unread characters will be read again in last-in first-out order. If @var{port} is @@ -2776,7 +3099,8 @@ not supplied, the current input port is used. @end deffn unread-string -@deffn primitive unread-string str port +@deffn {Scheme Procedure} unread-string str port +@deffnx {C Function} scm_unread_string (str, port) Place the string @var{str} in @var{port} so that its characters will be read in subsequent read operations. If called multiple times, the unread characters will be read again in last-in first-out order. If @@ -2784,7 +3108,8 @@ unread characters will be read again in last-in first-out order. If @end deffn seek -@deffn primitive seek fd_port offset whence +@deffn {Scheme Procedure} seek fd_port offset whence +@deffnx {C Function} scm_seek (fd_port, offset, whence) Sets the current position of @var{fd/port} to the integer @var{offset}, which is interpreted according to the value of @var{whence}. @@ -2811,7 +3136,8 @@ that the current position of a port can be obtained using: @end deffn truncate-file -@deffn primitive truncate-file object [length] +@deffn {Scheme Procedure} truncate-file object [length] +@deffnx {C Function} scm_truncate_file (object, length) Truncates the object referred to by @var{object} to at most @var{length} bytes. @var{object} can be a string containing a file name or an integer file descriptor or a port. @@ -2821,18 +3147,21 @@ position. The return value is unspecified. @end deffn port-line -@deffn primitive port-line port +@deffn {Scheme Procedure} port-line port +@deffnx {C Function} scm_port_line (port) Return the current line number for @var{port}. @end deffn set-port-line! -@deffn primitive set-port-line! port line +@deffn {Scheme Procedure} set-port-line! port line +@deffnx {C Function} scm_set_port_line_x (port, line) Set the current line number for @var{port} to @var{line}. @end deffn port-column -@deffn primitive port-column port -@deffnx primitive port-line port +@deffn {Scheme Procedure} port-column port +@deffnx {Scheme Procedure} port-line port +@deffnx {C Function} scm_port_column (port) Return the current column number or line number of @var{port}, using the current input port if none is specified. If the number is unknown, the result is #f. Otherwise, the result is a 0-origin integer @@ -2844,21 +3173,24 @@ what non-programmers will find most natural.) @end deffn set-port-column! -@deffn primitive set-port-column! port column -@deffnx primitive set-port-line! port line +@deffn {Scheme Procedure} set-port-column! port column +@deffnx {Scheme Procedure} set-port-line! port line +@deffnx {C Function} scm_set_port_column_x (port, column) Set the current column or line number of @var{port}, using the current input port if none is specified. @end deffn port-filename -@deffn primitive port-filename port +@deffn {Scheme Procedure} port-filename port +@deffnx {C Function} scm_port_filename (port) Return the filename associated with @var{port}. This function returns the strings "standard input", "standard output" and "standard error" when called on the current input, output and error ports respectively. @end deffn set-port-filename! -@deffn primitive set-port-filename! port filename +@deffn {Scheme Procedure} set-port-filename! port filename +@deffnx {C Function} scm_set_port_filename_x (port, filename) Change the filename associated with @var{port}, using the current input port if none is specified. Note that this does not change the port's source of data, but only the value that is returned by @@ -2866,7 +3198,8 @@ source of data, but only the value that is returned by @end deffn %make-void-port -@deffn primitive %make-void-port mode +@deffn {Scheme Procedure} %make-void-port mode +@deffnx {C Function} scm_sys_make_void_port (mode) Create and return a new void port. A void port acts like /dev/null. The @var{mode} argument specifies the input/output modes for this port: see the @@ -2874,7 +3207,8 @@ documentation for @code{open-file} in @ref{File Ports}. @end deffn print-options-interface -@deffn primitive print-options-interface [setting] +@deffn {Scheme Procedure} print-options-interface [setting] +@deffnx {C Function} scm_print_options (setting) Option interface for the print options. Instead of using this procedure directly, use the procedures @code{print-enable}, @code{print-disable}, @code{print-set!} @@ -2882,7 +3216,8 @@ and @code{print-options}. @end deffn simple-format -@deffn primitive simple-format destination message . args +@deffn {Scheme Procedure} simple-format destination message . args +@deffnx {C Function} scm_simple_format (destination, message, args) Write @var{message} to @var{destination}, defaulting to the current output port. @var{message} can contain @code{~A} (was @code{%s}) and @@ -2897,65 +3232,78 @@ containing the formatted text. Does not add a trailing newline. @end deffn newline -@deffn primitive newline [port] +@deffn {Scheme Procedure} newline [port] +@deffnx {C Function} scm_newline (port) Send a newline to @var{port}. +If @var{port} is omitted, send to the current output port. @end deffn write-char -@deffn primitive write-char chr [port] +@deffn {Scheme Procedure} write-char chr [port] +@deffnx {C Function} scm_write_char (chr, port) Send character @var{chr} to @var{port}. @end deffn port-with-print-state -@deffn primitive port-with-print-state port pstate +@deffn {Scheme Procedure} port-with-print-state port pstate +@deffnx {C Function} scm_port_with_print_state (port, pstate) Create a new port which behaves like @var{port}, but with an included print state @var{pstate}. @end deffn get-print-state -@deffn primitive get-print-state port +@deffn {Scheme Procedure} get-print-state port +@deffnx {C Function} scm_get_print_state (port) Return the print state of the port @var{port}. If @var{port} has no associated print state, @code{#f} is returned. @end deffn procedure-properties -@deffn primitive procedure-properties proc +@deffn {Scheme Procedure} procedure-properties proc +@deffnx {C Function} scm_procedure_properties (proc) Return @var{obj}'s property list. @end deffn set-procedure-properties! -@deffn primitive set-procedure-properties! proc new_val +@deffn {Scheme Procedure} set-procedure-properties! proc new_val +@deffnx {C Function} scm_set_procedure_properties_x (proc, new_val) Set @var{obj}'s property list to @var{alist}. @end deffn procedure-property -@deffn primitive procedure-property p k +@deffn {Scheme Procedure} procedure-property p k +@deffnx {C Function} scm_procedure_property (p, k) Return the property of @var{obj} with name @var{key}. @end deffn set-procedure-property! -@deffn primitive set-procedure-property! p k v +@deffn {Scheme Procedure} set-procedure-property! p k v +@deffnx {C Function} scm_set_procedure_property_x (p, k, v) In @var{obj}'s property list, set the property named @var{key} to @var{value}. @end deffn procedure? -@deffn primitive procedure? obj +@deffn {Scheme Procedure} procedure? obj +@deffnx {C Function} scm_procedure_p (obj) Return @code{#t} if @var{obj} is a procedure. @end deffn closure? -@deffn primitive closure? obj +@deffn {Scheme Procedure} closure? obj +@deffnx {C Function} scm_closure_p (obj) Return @code{#t} if @var{obj} is a closure. @end deffn thunk? -@deffn primitive thunk? obj +@deffn {Scheme Procedure} thunk? obj +@deffnx {C Function} scm_thunk_p (obj) Return @code{#t} if @var{obj} is a thunk. @end deffn procedure-documentation -@deffn primitive procedure-documentation proc +@deffn {Scheme Procedure} procedure-documentation proc +@deffnx {C Function} scm_procedure_documentation (proc) Return the documentation string associated with @code{proc}. By convention, if a procedure contains more than one expression and the first expression is a string constant, that string is assumed to contain @@ -2963,25 +3311,29 @@ documentation for that procedure. @end deffn procedure-with-setter? -@deffn primitive procedure-with-setter? obj +@deffn {Scheme Procedure} procedure-with-setter? obj +@deffnx {C Function} scm_procedure_with_setter_p (obj) Return @code{#t} if @var{obj} is a procedure with an associated setter procedure. @end deffn make-procedure-with-setter -@deffn primitive make-procedure-with-setter procedure setter +@deffn {Scheme Procedure} make-procedure-with-setter procedure setter +@deffnx {C Function} scm_make_procedure_with_setter (procedure, setter) Create a new procedure which behaves like @var{procedure}, but with the associated setter @var{setter}. @end deffn procedure -@deffn primitive procedure proc +@deffn {Scheme Procedure} procedure proc +@deffnx {C Function} scm_procedure (proc) Return the procedure of @var{proc}, which must be either a procedure with setter, or an operator struct. @end deffn primitive-make-property -@deffn primitive primitive-make-property not_found_proc +@deffn {Scheme Procedure} primitive-make-property not_found_proc +@deffnx {C Function} scm_primitive_make_property (not_found_proc) Create a @dfn{property token} that can be used with @code{primitive-property-ref} and @code{primitive-property-set!}. See @code{primitive-property-ref} for the significance of @@ -2989,7 +3341,8 @@ See @code{primitive-property-ref} for the significance of @end deffn primitive-property-ref -@deffn primitive primitive-property-ref prop obj +@deffn {Scheme Procedure} primitive-property-ref prop obj +@deffnx {C Function} scm_primitive_property_ref (prop, obj) Return the property @var{prop} of @var{obj}. When no value has yet been associated with @var{prop} and @var{obj}, call @var{not-found-proc} instead (see @code{primitive-make-property}) @@ -3000,17 +3353,20 @@ default value of @var{prop}. @end deffn primitive-property-set! -@deffn primitive primitive-property-set! prop obj val +@deffn {Scheme Procedure} primitive-property-set! prop obj val +@deffnx {C Function} scm_primitive_property_set_x (prop, obj, val) Associate @var{code} with @var{prop} and @var{obj}. @end deffn primitive-property-del! -@deffn primitive primitive-property-del! prop obj +@deffn {Scheme Procedure} primitive-property-del! prop obj +@deffnx {C Function} scm_primitive_property_del_x (prop, obj) Remove any value associated with @var{prop} and @var{obj}. @end deffn random -@deffn primitive random n [state] +@deffn {Scheme Procedure} random n [state] +@deffnx {C Function} scm_random (n, state) Return a number in [0,N). Accepts a positive integer or real n and returns a @@ -3026,23 +3382,27 @@ as a side effect of the random operation. @end deffn copy-random-state -@deffn primitive copy-random-state [state] +@deffn {Scheme Procedure} copy-random-state [state] +@deffnx {C Function} scm_copy_random_state (state) Return a copy of the random state @var{state}. @end deffn seed->random-state -@deffn primitive seed->random-state seed +@deffn {Scheme Procedure} seed->random-state seed +@deffnx {C Function} scm_seed_to_random_state (seed) Return a new random state using @var{seed}. @end deffn random:uniform -@deffn primitive random:uniform [state] +@deffn {Scheme Procedure} random:uniform [state] +@deffnx {C Function} scm_random_uniform (state) Return a uniformly distributed inexact real random number in [0,1). @end deffn random:normal -@deffn primitive random:normal [state] +@deffn {Scheme Procedure} random:normal [state] +@deffnx {C Function} scm_random_normal (state) Return an inexact real in a normal distribution. The distribution used has mean 0 and standard deviation 1. For a normal distribution with mean m and standard deviation d use @@ -3050,7 +3410,8 @@ normal distribution with mean m and standard deviation d use @end deffn random:solid-sphere! -@deffn primitive random:solid-sphere! v [state] +@deffn {Scheme Procedure} random:solid-sphere! v [state] +@deffnx {C Function} scm_random_solid_sphere_x (v, state) Fills vect with inexact real random numbers the sum of whose squares is less than 1.0. Thinking of vect as coordinates in space of @@ -3060,7 +3421,8 @@ The sum of the squares of the numbers is returned. @end deffn random:hollow-sphere! -@deffn primitive random:hollow-sphere! v [state] +@deffn {Scheme Procedure} random:hollow-sphere! v [state] +@deffnx {C Function} scm_random_hollow_sphere_x (v, state) Fills vect with inexact real random numbers the sum of whose squares is equal to 1.0. Thinking of vect as coordinates in space of @@ -3070,21 +3432,24 @@ unit n-sphere. @end deffn random:normal-vector! -@deffn primitive random:normal-vector! v [state] +@deffn {Scheme Procedure} random:normal-vector! v [state] +@deffnx {C Function} scm_random_normal_vector_x (v, state) Fills vect with inexact real random numbers that are independent and standard normally distributed (i.e., with mean 0 and variance 1). @end deffn random:exp -@deffn primitive random:exp [state] +@deffn {Scheme Procedure} random:exp [state] +@deffnx {C Function} scm_random_exp (state) Return an inexact real in an exponential distribution with mean 1. For an exponential distribution with mean u use (* u (random:exp)). @end deffn %read-delimited! -@deffn primitive %read-delimited! delims str gobble [port [start [end]]] +@deffn {Scheme Procedure} %read-delimited! delims str gobble [port [start [end]]] +@deffnx {C Function} scm_read_delimited_x (delims, str, gobble, port, start, end) Read characters from @var{port} into @var{str} until one of the characters in the @var{delims} string is encountered. If @var{gobble} is true, discard the delimiter character; @@ -3103,7 +3468,8 @@ a delimiter, this value is @code{#f}. @end deffn %read-line -@deffn primitive %read-line [port] +@deffn {Scheme Procedure} %read-line [port] +@deffnx {C Function} scm_read_line (port) Read a newline-terminated line from @var{port}, allocating storage as necessary. The newline terminator (if any) is removed from the string, and a pair consisting of the line and its delimiter is returned. The @@ -3113,7 +3479,8 @@ delimiter may be either a newline or the @var{eof-object}; if @end deffn write-line -@deffn primitive write-line obj [port] +@deffn {Scheme Procedure} write-line obj [port] +@deffnx {C Function} scm_write_line (obj, port) Display @var{obj} and a newline character to @var{port}. If @var{port} is not specified, @code{(current-output-port)} is used. This function is equivalent to: @@ -3124,21 +3491,24 @@ used. This function is equivalent to: @end deffn read-options-interface -@deffn primitive read-options-interface [setting] +@deffn {Scheme Procedure} read-options-interface [setting] +@deffnx {C Function} scm_read_options (setting) Option interface for the read options. Instead of using this procedure directly, use the procedures @code{read-enable}, @code{read-disable}, @code{read-set!} and @var{read-options}. @end deffn read -@deffn primitive read [port] +@deffn {Scheme Procedure} read [port] +@deffnx {C Function} scm_read (port) Read an s-expression from the input port @var{port}, or from the current input port if @var{port} is not specified. Any whitespace before the next token is discarded. @end deffn read-hash-extend -@deffn primitive read-hash-extend chr proc +@deffn {Scheme Procedure} read-hash-extend chr proc +@deffnx {C Function} scm_read_hash_extend (chr, proc) Install the procedure @var{proc} for reading expressions starting with the character sequence @code{#} and @var{chr}. @var{proc} will be called with two arguments: the character @@ -3147,7 +3517,8 @@ returned will be the return value of @code{read}. @end deffn call-with-dynamic-root -@deffn primitive call-with-dynamic-root thunk handler +@deffn {Scheme Procedure} call-with-dynamic-root thunk handler +@deffnx {C Function} scm_call_with_dynamic_root (thunk, handler) Evaluate @code{(thunk)} in a new dynamic context, returning its value. If an error occurs during evaluation, apply @var{handler} to the @@ -3193,7 +3564,8 @@ be under a new dynamic root.) @end deffn dynamic-root -@deffn primitive dynamic-root +@deffn {Scheme Procedure} dynamic-root +@deffnx {C Function} scm_dynamic_root () Return an object representing the current dynamic root. These objects are only useful for comparison using @code{eq?}. @@ -3202,7 +3574,8 @@ in no way depend on this. @end deffn read-string!/partial -@deffn primitive read-string!/partial str [port_or_fdes [start [end]]] +@deffn {Scheme Procedure} read-string!/partial str [port_or_fdes [start [end]]] +@deffnx {C Function} scm_read_string_x_partial (str, port_or_fdes, start, end) Read characters from a port or file descriptor into a string @var{str}. A port must have an underlying file descriptor --- a so-called fport. This procedure is @@ -3243,7 +3616,8 @@ end-of-file check. @end deffn write-string/partial -@deffn primitive write-string/partial str [port_or_fdes [start [end]]] +@deffn {Scheme Procedure} write-string/partial str [port_or_fdes [start [end]]] +@deffnx {C Function} scm_write_string_partial (str, port_or_fdes, start, end) Write characters from a string @var{str} to a port or file descriptor. A port must have an underlying file descriptor --- a so-called fport. This procedure is @@ -3288,7 +3662,8 @@ return 0 immediately if the request size is 0 bytes. @end deffn sigaction -@deffn primitive sigaction signum [handler [flags]] +@deffn {Scheme Procedure} sigaction signum [handler [flags]] +@deffnx {C Function} scm_sigaction (signum, handler, flags) Install or report the signal handler for a specified signal. @var{signum} is the signal number, which can be specified using the value @@ -3318,13 +3693,15 @@ structures. @end deffn restore-signals -@deffn primitive restore-signals +@deffn {Scheme Procedure} restore-signals +@deffnx {C Function} scm_restore_signals () Return all signal handlers to the values they had before any call to @code{sigaction} was made. The return value is unspecified. @end deffn alarm -@deffn primitive alarm i +@deffn {Scheme Procedure} alarm i +@deffnx {C Function} scm_alarm (i) Set a timer to raise a @code{SIGALRM} signal after the specified number of seconds (an integer). It's advisable to install a signal handler for @@ -3337,7 +3714,8 @@ no previous alarm, the return value is zero. @end deffn setitimer -@deffn primitive setitimer which_timer interval_seconds interval_microseconds value_seconds value_microseconds +@deffn {Scheme Procedure} setitimer which_timer interval_seconds interval_microseconds value_seconds value_microseconds +@deffnx {C Function} scm_setitimer (which_timer, interval_seconds, interval_microseconds, value_seconds, value_microseconds) Set the timer specified by @var{which_timer} according to the given @var{interval_seconds}, @var{interval_microseconds}, @var{value_seconds}, and @var{value_microseconds} values. @@ -3356,7 +3734,8 @@ the seconds and microseconds of the timer @code{it_value}. @end deffn getitimer -@deffn primitive getitimer which_timer +@deffn {Scheme Procedure} getitimer which_timer +@deffnx {C Function} scm_getitimer (which_timer) Return information about the timer specified by @var{which_timer} Errors are handled as described in the guile info pages under ``POSIX Interface Conventions''. @@ -3371,33 +3750,38 @@ the seconds and microseconds of the timer @code{it_value}. @end deffn pause -@deffn primitive pause +@deffn {Scheme Procedure} pause +@deffnx {C Function} scm_pause () Pause the current process (thread?) until a signal arrives whose action is to either terminate the current process or invoke a handler procedure. The return value is unspecified. @end deffn sleep -@deffn primitive sleep i +@deffn {Scheme Procedure} sleep i +@deffnx {C Function} scm_sleep (i) Wait for the given number of seconds (an integer) or until a signal arrives. The return value is zero if the time elapses or the number of seconds remaining otherwise. @end deffn usleep -@deffn primitive usleep i +@deffn {Scheme Procedure} usleep i +@deffnx {C Function} scm_usleep (i) Sleep for I microseconds. @code{usleep} is not available on all platforms. @end deffn raise -@deffn primitive raise sig +@deffn {Scheme Procedure} raise sig +@deffnx {C Function} scm_raise (sig) Sends a specified signal @var{sig} to the current process, where @var{sig} is as described for the kill procedure. @end deffn system -@deffn primitive system [cmd] +@deffn {Scheme Procedure} system [cmd] +@deffnx {C Function} scm_system (cmd) Execute @var{cmd} using the operating system's "command processor". Under Unix this is usually the default shell @code{sh}. The value returned is @var{cmd}'s exit status as @@ -3409,21 +3793,24 @@ indicating whether the command processor is available. @end deffn getenv -@deffn primitive getenv nam +@deffn {Scheme Procedure} getenv nam +@deffnx {C Function} scm_getenv (nam) Looks up the string @var{name} in the current environment. The return value is @code{#f} unless a string of the form @code{NAME=VALUE} is found, in which case the string @code{VALUE} is returned. @end deffn primitive-exit -@deffn primitive primitive-exit [status] +@deffn {Scheme Procedure} primitive-exit [status] +@deffnx {C Function} scm_primitive_exit (status) Terminate the current process without unwinding the Scheme stack. This is would typically be useful after a fork. The exit status is @var{status} if supplied, otherwise zero. @end deffn restricted-vector-sort! -@deffn primitive restricted-vector-sort! vec less startpos endpos +@deffn {Scheme Procedure} restricted-vector-sort! vec less startpos endpos +@deffnx {C Function} scm_restricted_vector_sort_x (vec, less, startpos, endpos) Sort the vector @var{vec}, using @var{less} for comparing the vector elements. @var{startpos} and @var{endpos} delimit the range of the vector which gets sorted. The return value @@ -3431,24 +3818,28 @@ is not specified. @end deffn sorted? -@deffn primitive sorted? items less +@deffn {Scheme Procedure} sorted? items less +@deffnx {C Function} scm_sorted_p (items, less) Return @code{#t} iff @var{items} is a list or a vector such that for all 1 <= i <= m, the predicate @var{less} returns true when applied to all elements i - 1 and i @end deffn merge -@deffn primitive merge alist blist less -Takes two lists @var{alist} and @var{blist} such that -@code{(sorted? alist less?)} and @code{(sorted? blist less?)} and -returns a new list in which the elements of @var{alist} and +@deffn {Scheme Procedure} merge alist blist less +@deffnx {C Function} scm_merge (alist, blist, less) +Merge two already sorted lists into one. +Given two lists @var{alist} and @var{blist}, such that +@code{(sorted? alist less?)} and @code{(sorted? blist less?)}, +return a new list in which the elements of @var{alist} and @var{blist} have been stably interleaved so that @code{(sorted? (merge alist blist less?) less?)}. Note: this does _not_ accept vectors. @end deffn merge! -@deffn primitive merge! alist blist less +@deffn {Scheme Procedure} merge! alist blist less +@deffnx {C Function} scm_merge_x (alist, blist, less) Takes two lists @var{alist} and @var{blist} such that @code{(sorted? alist less?)} and @code{(sorted? blist less?)} and returns a new list in which the elements of @var{alist} and @@ -3459,7 +3850,8 @@ Note: this does _not_ accept vectors. @end deffn sort! -@deffn primitive sort! items less +@deffn {Scheme Procedure} sort! items less +@deffnx {C Function} scm_sort_x (items, less) Sort the sequence @var{items}, which may be a list or a vector. @var{less} is used for comparing the sequence elements. The sorting is destructive, that means that the @@ -3468,14 +3860,16 @@ This is not a stable sort. @end deffn sort -@deffn primitive sort items less +@deffn {Scheme Procedure} sort items less +@deffnx {C Function} scm_sort (items, less) Sort the sequence @var{items}, which may be a list or a vector. @var{less} is used for comparing the sequence elements. This is not a stable sort. @end deffn stable-sort! -@deffn primitive stable-sort! items less +@deffn {Scheme Procedure} stable-sort! items less +@deffnx {C Function} scm_stable_sort_x (items, less) Sort the sequence @var{items}, which may be a list or a vector. @var{less} is used for comparing the sequence elements. The sorting is destructive, that means that the input sequence @@ -3484,14 +3878,16 @@ This is a stable sort. @end deffn stable-sort -@deffn primitive stable-sort items less +@deffn {Scheme Procedure} stable-sort items less +@deffnx {C Function} scm_stable_sort (items, less) Sort the sequence @var{items}, which may be a list or a vector. @var{less} is used for comparing the sequence elements. This is a stable sort. @end deffn sort-list! -@deffn primitive sort-list! items less +@deffn {Scheme Procedure} sort-list! items less +@deffnx {C Function} scm_sort_list_x (items, less) Sort the list @var{items}, using @var{less} for comparing the list elements. The sorting is destructive, that means that the input list is modified to produce the sorted result. @@ -3499,41 +3895,48 @@ This is a stable sort. @end deffn sort-list -@deffn primitive sort-list items less +@deffn {Scheme Procedure} sort-list items less +@deffnx {C Function} scm_sort_list (items, less) Sort the list @var{items}, using @var{less} for comparing the list elements. This is a stable sort. @end deffn source-properties -@deffn primitive source-properties obj +@deffn {Scheme Procedure} source-properties obj +@deffnx {C Function} scm_source_properties (obj) Return the source property association list of @var{obj}. @end deffn set-source-properties! -@deffn primitive set-source-properties! obj plist +@deffn {Scheme Procedure} set-source-properties! obj plist +@deffnx {C Function} scm_set_source_properties_x (obj, plist) Install the association list @var{plist} as the source property list for @var{obj}. @end deffn source-property -@deffn primitive source-property obj key +@deffn {Scheme Procedure} source-property obj key +@deffnx {C Function} scm_source_property (obj, key) Return the source property specified by @var{key} from @var{obj}'s source property list. @end deffn set-source-property! -@deffn primitive set-source-property! obj key datum +@deffn {Scheme Procedure} set-source-property! obj key datum +@deffnx {C Function} scm_set_source_property_x (obj, key, datum) Set the source property of object @var{obj}, which is specified by @var{key} to @var{datum}. Normally, the key will be a symbol. @end deffn stack? -@deffn primitive stack? obj +@deffn {Scheme Procedure} stack? obj +@deffnx {C Function} scm_stack_p (obj) Return @code{#t} if @var{obj} is a calling stack. @end deffn make-stack -@deffn primitive make-stack obj . args +@deffn {Scheme Procedure} make-stack obj . args +@deffnx {C Function} scm_make_stack (obj, args) Create a new stack. If @var{obj} is @code{#t}, the current evaluation stack is used for creating the stack frames, otherwise the frames are taken from @var{obj} (which must be @@ -3565,93 +3968,110 @@ taken as 0. @end deffn stack-id -@deffn primitive stack-id stack +@deffn {Scheme Procedure} stack-id stack +@deffnx {C Function} scm_stack_id (stack) Return the identifier given to @var{stack} by @code{start-stack}. @end deffn stack-ref -@deffn primitive stack-ref stack index +@deffn {Scheme Procedure} stack-ref stack index +@deffnx {C Function} scm_stack_ref (stack, index) Return the @var{index}'th frame from @var{stack}. @end deffn stack-length -@deffn primitive stack-length stack +@deffn {Scheme Procedure} stack-length stack +@deffnx {C Function} scm_stack_length (stack) Return the length of @var{stack}. @end deffn frame? -@deffn primitive frame? obj +@deffn {Scheme Procedure} frame? obj +@deffnx {C Function} scm_frame_p (obj) Return @code{#t} if @var{obj} is a stack frame. @end deffn last-stack-frame -@deffn primitive last-stack-frame obj +@deffn {Scheme Procedure} last-stack-frame obj +@deffnx {C Function} scm_last_stack_frame (obj) Return a stack which consists of a single frame, which is the last stack frame for @var{obj}. @var{obj} must be either a debug object or a continuation. @end deffn frame-number -@deffn primitive frame-number frame +@deffn {Scheme Procedure} frame-number frame +@deffnx {C Function} scm_frame_number (frame) Return the frame number of @var{frame}. @end deffn frame-source -@deffn primitive frame-source frame +@deffn {Scheme Procedure} frame-source frame +@deffnx {C Function} scm_frame_source (frame) Return the source of @var{frame}. @end deffn frame-procedure -@deffn primitive frame-procedure frame +@deffn {Scheme Procedure} frame-procedure frame +@deffnx {C Function} scm_frame_procedure (frame) Return the procedure for @var{frame}, or @code{#f} if no procedure is associated with @var{frame}. @end deffn frame-arguments -@deffn primitive frame-arguments frame +@deffn {Scheme Procedure} frame-arguments frame +@deffnx {C Function} scm_frame_arguments (frame) Return the arguments of @var{frame}. @end deffn frame-previous -@deffn primitive frame-previous frame +@deffn {Scheme Procedure} frame-previous frame +@deffnx {C Function} scm_frame_previous (frame) Return the previous frame of @var{frame}, or @code{#f} if @var{frame} is the first frame in its stack. @end deffn frame-next -@deffn primitive frame-next frame +@deffn {Scheme Procedure} frame-next frame +@deffnx {C Function} scm_frame_next (frame) Return the next frame of @var{frame}, or @code{#f} if @var{frame} is the last frame in its stack. @end deffn frame-real? -@deffn primitive frame-real? frame +@deffn {Scheme Procedure} frame-real? frame +@deffnx {C Function} scm_frame_real_p (frame) Return @code{#t} if @var{frame} is a real frame. @end deffn frame-procedure? -@deffn primitive frame-procedure? frame +@deffn {Scheme Procedure} frame-procedure? frame +@deffnx {C Function} scm_frame_procedure_p (frame) Return @code{#t} if a procedure is associated with @var{frame}. @end deffn frame-evaluating-args? -@deffn primitive frame-evaluating-args? frame +@deffn {Scheme Procedure} frame-evaluating-args? frame +@deffnx {C Function} scm_frame_evaluating_args_p (frame) Return @code{#t} if @var{frame} contains evaluated arguments. @end deffn frame-overflow? -@deffn primitive frame-overflow? frame +@deffn {Scheme Procedure} frame-overflow? frame +@deffnx {C Function} scm_frame_overflow_p (frame) Return @code{#t} if @var{frame} is an overflow frame. @end deffn get-internal-real-time -@deffn primitive get-internal-real-time +@deffn {Scheme Procedure} get-internal-real-time +@deffnx {C Function} scm_get_internal_real_time () Return the number of time units since the interpreter was started. @end deffn times -@deffn primitive times +@deffn {Scheme Procedure} times +@deffnx {C Function} scm_times () Return an object with information about real and processor time. The following procedures accept such an object as an argument and return a selected component: @@ -3676,20 +4096,23 @@ terminated child processes. @end deffn get-internal-run-time -@deffn primitive get-internal-run-time +@deffn {Scheme Procedure} get-internal-run-time +@deffnx {C Function} scm_get_internal_run_time () Return the number of time units of processor time used by the interpreter. Both @emph{system} and @emph{user} time are included but subprocesses are not. @end deffn current-time -@deffn primitive current-time +@deffn {Scheme Procedure} current-time +@deffnx {C Function} scm_current_time () Return the number of seconds since 1970-01-01 00:00:00 UTC, excluding leap seconds. @end deffn gettimeofday -@deffn primitive gettimeofday +@deffn {Scheme Procedure} gettimeofday +@deffnx {C Function} scm_gettimeofday () Return a pair containing the number of seconds and microseconds since 1970-01-01 00:00:00 UTC, excluding leap seconds. Note: whether true microsecond resolution is available depends on the @@ -3697,7 +4120,8 @@ operating system. @end deffn localtime -@deffn primitive localtime time [zone] +@deffn {Scheme Procedure} localtime time [zone] +@deffnx {C Function} scm_localtime (time, zone) Return an object representing the broken down components of @var{time}, an integer like the one returned by @code{current-time}. The time zone for the calculation is @@ -3706,14 +4130,16 @@ optionally specified by @var{zone} (a string), otherwise the @end deffn gmtime -@deffn primitive gmtime time +@deffn {Scheme Procedure} gmtime time +@deffnx {C Function} scm_gmtime (time) Return an object representing the broken down components of @var{time}, an integer like the one returned by @code{current-time}. The values are calculated for UTC. @end deffn mktime -@deffn primitive mktime sbd_time [zone] +@deffn {Scheme Procedure} mktime sbd_time [zone] +@deffnx {C Function} scm_mktime (sbd_time, zone) @var{bd-time} is an object representing broken down time and @code{zone} is an optional time zone specifier (otherwise the TZ environment variable or the system default is used). @@ -3725,7 +4151,8 @@ as @var{bd-time} but with normalized values. @end deffn tzset -@deffn primitive tzset +@deffn {Scheme Procedure} tzset +@deffnx {C Function} scm_tzset () Initialize the timezone from the TZ environment variable or the system default. It's not usually necessary to call this procedure since it's done automatically by other procedures that depend on the @@ -3733,7 +4160,8 @@ timezone. @end deffn strftime -@deffn primitive strftime format stime +@deffn {Scheme Procedure} strftime format stime +@deffnx {C Function} scm_strftime (format, stime) Formats a time specification @var{time} using @var{template}. @var{time} is an object with time components in the form returned by @code{localtime} or @code{gmtime}. @var{template} is a string which can include formatting @@ -3744,7 +4172,8 @@ is the formatted string. @end deffn strptime -@deffn primitive strptime format string +@deffn {Scheme Procedure} strptime format string +@deffnx {C Function} scm_strptime (format, string) Performs the reverse action to @code{strftime}, parsing @var{string} according to the specification supplied in @var{template}. The interpretation of month and day names is @@ -3758,25 +4187,27 @@ which were used for the conversion. @end deffn string? -@deffn primitive string? obj -Return @code{#t} iff @var{obj} is a string, else returns -@code{#f}. +@deffn {Scheme Procedure} string? obj +@deffnx {C Function} scm_string_p (obj) +Return @code{#t} iff @var{obj} is a string, else @code{#f}. @end deffn list->string -@deffn primitive list->string +@deffn {Scheme Procedure} list->string implemented by the C function "scm_string" @end deffn string -@deffn primitive string . chrs -@deffnx primitive list->string chrs +@deffn {Scheme Procedure} string . chrs +@deffnx {Scheme Procedure} list->string chrs +@deffnx {C Function} scm_string (chrs) Return a newly allocated string composed of the arguments, @var{chrs}. @end deffn make-string -@deffn primitive make-string k [chr] +@deffn {Scheme Procedure} make-string k [chr] +@deffnx {C Function} scm_make_string (k, chr) Return a newly allocated string of length @var{k}. If @var{chr} is given, then all elements of the string are initialized to @var{chr}, otherwise the contents @@ -3784,25 +4215,29 @@ of the @var{string} are unspecified. @end deffn string-length -@deffn primitive string-length string +@deffn {Scheme Procedure} string-length string +@deffnx {C Function} scm_string_length (string) Return the number of characters in @var{string}. @end deffn string-ref -@deffn primitive string-ref str k +@deffn {Scheme Procedure} string-ref str k +@deffnx {C Function} scm_string_ref (str, k) Return character @var{k} of @var{str} using zero-origin indexing. @var{k} must be a valid index of @var{str}. @end deffn string-set! -@deffn primitive string-set! str k chr +@deffn {Scheme Procedure} string-set! str k chr +@deffnx {C Function} scm_string_set_x (str, k, chr) Store @var{chr} in element @var{k} of @var{str} and return an unspecified value. @var{k} must be a valid index of @var{str}. @end deffn substring -@deffn primitive substring str start [end] +@deffn {Scheme Procedure} substring str start [end] +@deffnx {C Function} scm_substring (str, start, end) Return a newly allocated string formed from the characters of @var{str} beginning with index @var{start} (inclusive) and ending with index @var{end} (exclusive). @@ -3813,13 +4248,15 @@ exact integers satisfying: @end deffn string-append -@deffn primitive string-append . args +@deffn {Scheme Procedure} string-append . args +@deffnx {C Function} scm_string_append (args) Return a newly allocated string whose characters form the concatenation of the given strings, @var{args}. @end deffn string-index -@deffn primitive string-index str chr [frm [to]] +@deffn {Scheme Procedure} string-index str chr [frm [to]] +@deffnx {C Function} scm_string_index (str, chr, frm, to) Return the index of the first occurrence of @var{chr} in @var{str}. The optional integer arguments @var{frm} and @var{to} limit the search to a portion of the string. This @@ -3839,7 +4276,8 @@ procedure essentially implements the @code{index} or @end deffn string-rindex -@deffn primitive string-rindex str chr [frm [to]] +@deffn {Scheme Procedure} string-rindex str chr [frm [to]] +@deffnx {C Function} scm_string_rindex (str, chr, frm, to) Like @code{string-index}, but search from the right of the string rather than from the left. This procedure essentially implements the @code{rindex} or @code{strrchr} functions from @@ -3857,40 +4295,17 @@ the C library. @end lisp @end deffn -substring-move-left! -@deffn primitive substring-move-left! -implemented by the C function "scm_substring_move_x" -@end deffn - -substring-move-right! -@deffn primitive substring-move-right! -implemented by the C function "scm_substring_move_x" -@end deffn - substring-move! -@deffn primitive substring-move! str1 start1 end1 str2 start2 -@deffnx primitive substring-move-left! str1 start1 end1 str2 start2 -@deffnx primitive substring-move-right! str1 start1 end1 str2 start2 +@deffn {Scheme Procedure} substring-move! str1 start1 end1 str2 start2 +@deffnx {C Function} scm_substring_move_x (str1, start1, end1, str2, start2) Copy the substring of @var{str1} bounded by @var{start1} and @var{end1} into @var{str2} beginning at position @var{start2}. -@code{substring-move-right!} begins copying from the rightmost character -and moves left, and @code{substring-move-left!} copies from the leftmost -character moving right. - -It is useful to have two functions that copy in different directions so -that substrings can be copied back and forth within a single string. If -you wish to copy text from the left-hand side of a string to the -right-hand side of the same string, and the source and destination -overlap, you must be careful to copy the rightmost characters of the -text first, to avoid clobbering your data. Hence, when @var{str1} and -@var{str2} are the same string, you should use -@code{substring-move-right!} when moving text from left to right, and -@code{substring-move-left!} otherwise. If @code{str1} and @samp{str2} -are different strings, it does not matter which function you use. +@var{str1} and @var{str2} can be the same string. @end deffn substring-fill! -@deffn primitive substring-fill! str start end fill +@deffn {Scheme Procedure} substring-fill! str start end fill +@deffnx {C Function} scm_substring_fill_x (str, start, end, fill) Change every character in @var{str} between @var{start} and @var{end} to @var{fill}. @@ -3903,7 +4318,8 @@ y @end deffn string-null? -@deffn primitive string-null? str +@deffn {Scheme Procedure} string-null? str +@deffnx {C Function} scm_string_null_p (str) Return @code{#t} if @var{str}'s length is zero, and @code{#f} otherwise. @lisp @@ -3914,7 +4330,8 @@ y @result{} "foo" @end deffn string->list -@deffn primitive string->list str +@deffn {Scheme Procedure} string->list str +@deffnx {C Function} scm_string_to_list (str) Return a newly allocated list of the characters that make up the given string @var{str}. @code{string->list} and @code{list->string} are inverses as far as @samp{equal?} is @@ -3922,18 +4339,21 @@ concerned. @end deffn string-copy -@deffn primitive string-copy str +@deffn {Scheme Procedure} string-copy str +@deffnx {C Function} scm_string_copy (str) Return a newly allocated copy of the given @var{string}. @end deffn string-fill! -@deffn primitive string-fill! str chr +@deffn {Scheme Procedure} string-fill! str chr +@deffnx {C Function} scm_string_fill_x (str, chr) Store @var{char} in every element of the given @var{string} and return an unspecified value. @end deffn string-upcase! -@deffn primitive string-upcase! str +@deffn {Scheme Procedure} string-upcase! str +@deffnx {C Function} scm_string_upcase_x (str) Destructively upcase every character in @var{str} and return @var{str}. @lisp @@ -3944,13 +4364,15 @@ y @result{} "ARRDEFG" @end deffn string-upcase -@deffn primitive string-upcase str +@deffn {Scheme Procedure} string-upcase str +@deffnx {C Function} scm_string_upcase (str) Return a freshly allocated string containing the characters of @var{str} in upper case. @end deffn string-downcase! -@deffn primitive string-downcase! str +@deffn {Scheme Procedure} string-downcase! str +@deffnx {C Function} scm_string_downcase_x (str) Destructively downcase every character in @var{str} and return @var{str}. @lisp @@ -3961,13 +4383,15 @@ y @result{} "arrdefg" @end deffn string-downcase -@deffn primitive string-downcase str +@deffn {Scheme Procedure} string-downcase str +@deffnx {C Function} scm_string_downcase (str) Return a freshly allocation string containing the characters in @var{str} in lower case. @end deffn string-capitalize! -@deffn primitive string-capitalize! str +@deffn {Scheme Procedure} string-capitalize! str +@deffnx {C Function} scm_string_capitalize_x (str) Upcase the first character of every word in @var{str} destructively and return @var{str}. @@ -3979,43 +4403,46 @@ y @result{} "Hello World" @end deffn string-capitalize -@deffn primitive string-capitalize str +@deffn {Scheme Procedure} string-capitalize str +@deffnx {C Function} scm_string_capitalize (str) Return a freshly allocated string with the characters in @var{str}, where the first character of every word is capitalized. @end deffn string-split -@deffn primitive string-split str chr +@deffn {Scheme Procedure} string-split str chr +@deffnx {C Function} scm_string_split (str, chr) Split the string @var{str} into the a list of the substrings delimited by appearances of the character @var{chr}. Note that an empty substring between separator characters will result in an empty string in the result list. @lisp -(string-split "root:x:0:0:root:/root:/bin/bash" #:) +(string-split "root:x:0:0:root:/root:/bin/bash" #\:) @result{} ("root" "x" "0" "0" "root" "/root" "/bin/bash") -(string-split "::" #:) +(string-split "::" #\:) @result{} ("" "" "") -(string-split "" #:) +(string-split "" #\:) @result{} ("") @end lisp @end deffn string-ci->symbol -@deffn primitive string-ci->symbol str +@deffn {Scheme Procedure} string-ci->symbol str +@deffnx {C Function} scm_string_ci_to_symbol (str) Return the symbol whose name is @var{str}. @var{str} is converted to lowercase before the conversion is done, if Guile -is currently reading symbols case--insensitively. +is currently reading symbols case-insensitively. @end deffn string=? -@deffn primitive string=? s1 s2 +@deffn {Scheme Procedure} string=? s1 s2 Lexicographic equality predicate; return @code{#t} if the two strings are the same length and contain the same characters in the same positions, otherwise return @code{#f}. @@ -4027,7 +4454,7 @@ characters. @end deffn string-ci=? -@deffn primitive string-ci=? s1 s2 +@deffn {Scheme Procedure} string-ci=? s1 s2 Case-insensitive string equality predicate; return @code{#t} if the two strings are the same length and their component characters match (ignoring case) at each position; otherwise @@ -4035,80 +4462,84 @@ return @code{#f}. @end deffn string<? -@deffn primitive string<? s1 s2 +@deffn {Scheme Procedure} string<? s1 s2 Lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically less than @var{s2}. @end deffn string<=? -@deffn primitive string<=? s1 s2 +@deffn {Scheme Procedure} string<=? s1 s2 Lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically less than or equal to @var{s2}. @end deffn string>? -@deffn primitive string>? s1 s2 +@deffn {Scheme Procedure} string>? s1 s2 Lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically greater than @var{s2}. @end deffn string>=? -@deffn primitive string>=? s1 s2 +@deffn {Scheme Procedure} string>=? s1 s2 Lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically greater than or equal to @var{s2}. @end deffn string-ci<? -@deffn primitive string-ci<? s1 s2 +@deffn {Scheme Procedure} string-ci<? s1 s2 Case insensitive lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically less than @var{s2} regardless of case. @end deffn string-ci<=? -@deffn primitive string-ci<=? s1 s2 +@deffn {Scheme Procedure} string-ci<=? s1 s2 Case insensitive lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically less than or equal to @var{s2} regardless of case. @end deffn string-ci>? -@deffn primitive string-ci>? s1 s2 +@deffn {Scheme Procedure} string-ci>? s1 s2 Case insensitive lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically greater than @var{s2} regardless of case. @end deffn string-ci>=? -@deffn primitive string-ci>=? s1 s2 +@deffn {Scheme Procedure} string-ci>=? s1 s2 Case insensitive lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically greater than or equal to @var{s2} regardless of case. @end deffn object->string -@deffn primitive object->string obj [printer] +@deffn {Scheme Procedure} object->string obj [printer] +@deffnx {C Function} scm_object_to_string (obj, printer) Return a Scheme string obtained by printing @var{obj}. Printing function can be specified by the optional second argument @var{printer} (default: @code{write}). @end deffn call-with-output-string -@deffn primitive call-with-output-string proc +@deffn {Scheme Procedure} call-with-output-string proc +@deffnx {C Function} scm_call_with_output_string (proc) Calls the one-argument procedure @var{proc} with a newly created output port. When the function returns, the string composed of the characters written into the port is returned. @end deffn call-with-input-string -@deffn primitive call-with-input-string string proc +@deffn {Scheme Procedure} call-with-input-string string proc +@deffnx {C Function} scm_call_with_input_string (string, proc) Calls the one-argument procedure @var{proc} with a newly created input port from which @var{string}'s contents may be read. The value yielded by the @var{proc} is returned. @end deffn open-input-string -@deffn primitive open-input-string str +@deffn {Scheme Procedure} open-input-string str +@deffnx {C Function} scm_open_input_string (str) Take a string and return an input port that delivers characters from the string. The port can be closed by @code{close-input-port}, though its storage will be reclaimed @@ -4116,7 +4547,8 @@ by the garbage collector if it becomes inaccessible. @end deffn open-output-string -@deffn primitive open-output-string +@deffn {Scheme Procedure} open-output-string +@deffnx {C Function} scm_open_output_string () Return an output port that will accumulate characters for retrieval by @code{get-output-string}. The port can be closed by the procedure @code{close-output-port}, though its storage @@ -4125,14 +4557,16 @@ inaccessible. @end deffn get-output-string -@deffn primitive get-output-string port +@deffn {Scheme Procedure} get-output-string port +@deffnx {C Function} scm_get_output_string (port) Given an output port created by @code{open-output-string}, return a string consisting of the characters that have been output to the port so far. @end deffn eval-string -@deffn primitive eval-string string +@deffn {Scheme Procedure} eval-string string +@deffnx {C Function} scm_eval_string (string) Evaluate @var{string} as the text representation of a Scheme form or forms, and return whatever value they produce. Evaluation takes place in the environment returned by the @@ -4140,7 +4574,8 @@ procedure @code{interaction-environment}. @end deffn make-struct-layout -@deffn primitive make-struct-layout fields +@deffn {Scheme Procedure} make-struct-layout fields +@deffnx {C Function} scm_make_struct_layout (fields) Return a new structure layout object. @var{fields} must be a string made up of pairs of characters @@ -4154,18 +4589,21 @@ indicate that the field is a tail-array. @end deffn struct? -@deffn primitive struct? x +@deffn {Scheme Procedure} struct? x +@deffnx {C Function} scm_struct_p (x) Return @code{#t} iff @var{x} is a structure object, else @code{#f}. @end deffn struct-vtable? -@deffn primitive struct-vtable? x +@deffn {Scheme Procedure} struct-vtable? x +@deffnx {C Function} scm_struct_vtable_p (x) Return @code{#t} iff @var{x} is a vtable structure. @end deffn make-struct -@deffn primitive make-struct vtable tail_array_size . init +@deffn {Scheme Procedure} make-struct vtable tail_array_size . init +@deffnx {C Function} scm_make_struct (vtable, tail_array_size, init) Create a new structure. @var{type} must be a vtable structure (@pxref{Vtables}). @@ -4194,7 +4632,8 @@ For more information, see the documentation for @code{make-vtable-vtable}. @end deffn make-vtable-vtable -@deffn primitive make-vtable-vtable user_fields tail_array_size . init +@deffn {Scheme Procedure} make-vtable-vtable user_fields tail_array_size . init +@deffnx {C Function} scm_make_vtable_vtable (user_fields, tail_array_size, init) Return a new, self-describing vtable structure. @var{user-fields} is a string describing user defined fields of the @@ -4254,8 +4693,9 @@ ball @result{} #<a green ball owned by Nisse> @end deffn struct-ref -@deffn primitive struct-ref handle pos -@deffnx primitive struct-set! struct n value +@deffn {Scheme Procedure} struct-ref handle pos +@deffnx {Scheme Procedure} struct-set! struct n value +@deffnx {C Function} scm_struct_ref (handle, pos) Access (or modify) the @var{n}th field of @var{struct}. If the field is of type 'p', then it can be set to an arbitrary value. @@ -4265,40 +4705,47 @@ integer value small enough to fit in one machine word. @end deffn struct-set! -@deffn primitive struct-set! handle pos val +@deffn {Scheme Procedure} struct-set! handle pos val +@deffnx {C Function} scm_struct_set_x (handle, pos, val) Set the slot of the structure @var{handle} with index @var{pos} to @var{val}. Signal an error if the slot can not be written to. @end deffn struct-vtable -@deffn primitive struct-vtable handle +@deffn {Scheme Procedure} struct-vtable handle +@deffnx {C Function} scm_struct_vtable (handle) Return the vtable structure that describes the type of @var{struct}. @end deffn struct-vtable-tag -@deffn primitive struct-vtable-tag handle +@deffn {Scheme Procedure} struct-vtable-tag handle +@deffnx {C Function} scm_struct_vtable_tag (handle) Return the vtable tag of the structure @var{handle}. @end deffn struct-vtable-name -@deffn primitive struct-vtable-name vtable +@deffn {Scheme Procedure} struct-vtable-name vtable +@deffnx {C Function} scm_struct_vtable_name (vtable) Return the name of the vtable @var{vtable}. @end deffn set-struct-vtable-name! -@deffn primitive set-struct-vtable-name! vtable name +@deffn {Scheme Procedure} set-struct-vtable-name! vtable name +@deffnx {C Function} scm_set_struct_vtable_name_x (vtable, name) Set the name of the vtable @var{vtable} to @var{name}. @end deffn symbol? -@deffn primitive symbol? obj +@deffn {Scheme Procedure} symbol? obj +@deffnx {C Function} scm_symbol_p (obj) Return @code{#t} if @var{obj} is a symbol, otherwise return @code{#f}. @end deffn symbol->string -@deffn primitive symbol->string s +@deffn {Scheme Procedure} symbol->string s +@deffnx {C Function} scm_symbol_to_string (s) Return the name of @var{symbol} as a string. If the symbol was part of an object returned as the value of a literal expression (section @pxref{Literal expressions,,,r5rs, The Revised^5 @@ -4325,7 +4772,8 @@ standard case is lower case: @end deffn string->symbol -@deffn primitive string->symbol string +@deffn {Scheme Procedure} string->symbol string +@deffnx {C Function} scm_string_to_symbol (string) Return the symbol whose name is @var{string}. This procedure can create symbols with names containing special characters or letters in the non-standard case, but it is usually a bad idea @@ -4349,7 +4797,8 @@ standard case is lower case: @end deffn gensym -@deffn primitive gensym [prefix] +@deffn {Scheme Procedure} gensym [prefix] +@deffnx {C Function} scm_gensym (prefix) Create a new symbol with a name constructed from a prefix and a counter value. The string @var{prefix} can be specified as an optional argument. Default prefix is @code{g}. The counter @@ -4358,32 +4807,38 @@ resetting the counter. @end deffn symbol-hash -@deffn primitive symbol-hash symbol +@deffn {Scheme Procedure} symbol-hash symbol +@deffnx {C Function} scm_symbol_hash (symbol) Return a hash value for @var{symbol}. @end deffn symbol-fref -@deffn primitive symbol-fref s +@deffn {Scheme Procedure} symbol-fref s +@deffnx {C Function} scm_symbol_fref (s) Return the contents of @var{symbol}'s @dfn{function slot}. @end deffn symbol-pref -@deffn primitive symbol-pref s +@deffn {Scheme Procedure} symbol-pref s +@deffnx {C Function} scm_symbol_pref (s) Return the @dfn{property list} currently associated with @var{symbol}. @end deffn symbol-fset! -@deffn primitive symbol-fset! s val +@deffn {Scheme Procedure} symbol-fset! s val +@deffnx {C Function} scm_symbol_fset_x (s, val) Change the binding of @var{symbol}'s function slot. @end deffn symbol-pset! -@deffn primitive symbol-pset! s val +@deffn {Scheme Procedure} symbol-pset! s val +@deffnx {C Function} scm_symbol_pset_x (s, val) Change the binding of @var{symbol}'s property slot. @end deffn catch -@deffn primitive catch key thunk handler +@deffn {Scheme Procedure} catch key thunk handler +@deffnx {C Function} scm_catch (key, thunk, handler) Invoke @var{thunk} in the dynamic context of @var{handler} for exceptions matching @var{key}. If thunk throws to the symbol @var{key}, then @var{handler} is invoked this way: @@ -4405,7 +4860,8 @@ match this call to @code{catch}. @end deffn lazy-catch -@deffn primitive lazy-catch key thunk handler +@deffn {Scheme Procedure} lazy-catch key thunk handler +@deffnx {C Function} scm_lazy_catch (key, thunk, handler) This behaves exactly like @code{catch}, except that it does not unwind the stack before invoking @var{handler}. The @var{handler} procedure is not allowed to return: @@ -4413,7 +4869,8 @@ it must throw to another catch, or otherwise exit non-locally. @end deffn throw -@deffn primitive throw key . args +@deffn {Scheme Procedure} throw key . args +@deffnx {C Function} scm_throw (key, args) Invoke the catch form matching @var{key}, passing @var{args} to the @var{handler}. @@ -4424,7 +4881,8 @@ If there is no handler at all, Guile prints an error and then exits. @end deffn values -@deffn primitive values . args +@deffn {Scheme Procedure} values . args +@deffnx {C Function} scm_values (args) Delivers all of its arguments to its continuation. Except for continuations created by the @code{call-with-values} procedure, all continuations take exactly one value. The effect of @@ -4433,56 +4891,64 @@ were not created by @code{call-with-values} is unspecified. @end deffn make-variable -@deffn primitive make-variable init +@deffn {Scheme Procedure} make-variable init +@deffnx {C Function} scm_make_variable (init) Return a variable initialized to value @var{init}. @end deffn make-undefined-variable -@deffn primitive make-undefined-variable +@deffn {Scheme Procedure} make-undefined-variable +@deffnx {C Function} scm_make_undefined_variable () Return a variable that is initially unbound. @end deffn variable? -@deffn primitive variable? obj +@deffn {Scheme Procedure} variable? obj +@deffnx {C Function} scm_variable_p (obj) Return @code{#t} iff @var{obj} is a variable object, else return @code{#f}. @end deffn variable-ref -@deffn primitive variable-ref var +@deffn {Scheme Procedure} variable-ref var +@deffnx {C Function} scm_variable_ref (var) Dereference @var{var} and return its value. @var{var} must be a variable object; see @code{make-variable} and @code{make-undefined-variable}. @end deffn variable-set! -@deffn primitive variable-set! var val +@deffn {Scheme Procedure} variable-set! var val +@deffnx {C Function} scm_variable_set_x (var, val) Set the value of the variable @var{var} to @var{val}. @var{var} must be a variable object, @var{val} can be any value. Return an unspecified value. @end deffn variable-bound? -@deffn primitive variable-bound? var +@deffn {Scheme Procedure} variable-bound? var +@deffnx {C Function} scm_variable_bound_p (var) Return @code{#t} iff @var{var} is bound to a value. Throws an error if @var{var} is not a variable object. @end deffn vector? -@deffn primitive vector? obj +@deffn {Scheme Procedure} vector? obj +@deffnx {C Function} scm_vector_p (obj) Return @code{#t} if @var{obj} is a vector, otherwise return @code{#f}. @end deffn list->vector -@deffn primitive list->vector +@deffn {Scheme Procedure} list->vector implemented by the C function "scm_vector" @end deffn vector -@deffn primitive vector . l -@deffnx primitive list->vector l -Return a newly allocated vector whose elements contain the +@deffn {Scheme Procedure} vector . l +@deffnx {Scheme Procedure} list->vector l +@deffnx {C Function} scm_vector (l) +Return a newly allocated vector composed of the given arguments. Analogous to @code{list}. @lisp @@ -4491,17 +4957,18 @@ given arguments. Analogous to @code{list}. @end deffn make-vector -@deffn primitive make-vector k [fill] +@deffn {Scheme Procedure} make-vector k [fill] +@deffnx {C Function} scm_make_vector (k, fill) Return a newly allocated vector of @var{k} elements. If a -second argument is given, then each element is initialized to -@var{fill}. Otherwise the initial contents of each element is +second argument is given, then each position is initialized to +@var{fill}. Otherwise the initial contents of each position is unspecified. @end deffn vector->list -@deffn primitive vector->list v -Return a newly allocated list of the objects contained in the -elements of @var{vector}. +@deffn {Scheme Procedure} vector->list v +@deffnx {C Function} scm_vector_to_list (v) +Return a newly allocated list composed of the elements of @var{v}. @lisp (vector->list '#(dah dah didah)) @result{} (dah dah didah) @@ -4510,44 +4977,51 @@ elements of @var{vector}. @end deffn vector-fill! -@deffn primitive vector-fill! v fill -Store @var{fill} in every element of @var{vector}. The value +@deffn {Scheme Procedure} vector-fill! v fill +@deffnx {C Function} scm_vector_fill_x (v, fill) +Store @var{fill} in every position of @var{vector}. The value returned by @code{vector-fill!} is unspecified. @end deffn vector-move-left! -@deffn primitive vector-move-left! vec1 start1 end1 vec2 start2 +@deffn {Scheme Procedure} vector-move-left! vec1 start1 end1 vec2 start2 +@deffnx {C Function} scm_vector_move_left_x (vec1, start1, end1, vec2, start2) Vector version of @code{substring-move-left!}. @end deffn vector-move-right! -@deffn primitive vector-move-right! vec1 start1 end1 vec2 start2 +@deffn {Scheme Procedure} vector-move-right! vec1 start1 end1 vec2 start2 +@deffnx {C Function} scm_vector_move_right_x (vec1, start1, end1, vec2, start2) Vector version of @code{substring-move-right!}. @end deffn major-version -@deffn primitive major-version +@deffn {Scheme Procedure} major-version +@deffnx {C Function} scm_major_version () Return a string containing Guile's major version number. E.g., the 1 in "1.6.5". @end deffn minor-version -@deffn primitive minor-version +@deffn {Scheme Procedure} minor-version +@deffnx {C Function} scm_minor_version () Return a string containing Guile's minor version number. E.g., the 6 in "1.6.5". @end deffn micro-version -@deffn primitive micro-version +@deffn {Scheme Procedure} micro-version +@deffnx {C Function} scm_micro_version () Return a string containing Guile's micro version number. E.g., the 5 in "1.6.5". @end deffn version -@deffn primitive version -@deffnx primitive major-version -@deffnx primitive minor-version -@deffnx primitive micro-version +@deffn {Scheme Procedure} version +@deffnx {Scheme Procedure} major-version +@deffnx {Scheme Procedure} minor-version +@deffnx {Scheme Procedure} micro-version +@deffnx {C Function} scm_version () Return a string describing Guile's version number, or its major, minor or micro version number, respectively. @@ -4560,7 +5034,8 @@ or micro version number, respectively. @end deffn make-soft-port -@deffn primitive make-soft-port pv modes +@deffn {Scheme Procedure} make-soft-port pv modes +@deffnx {C Function} scm_make_soft_port (pv, modes) Return a port capable of receiving or delivering characters as specified by the @var{modes} string (@pxref{File Ports, open-file}). @var{pv} must be a vector of length 5. Its @@ -4605,7 +5080,8 @@ For example: @end deffn make-weak-vector -@deffn primitive make-weak-vector size [fill] +@deffn {Scheme Procedure} make-weak-vector size [fill] +@deffnx {C Function} scm_make_weak_vector (size, fill) Return a weak vector with @var{size} elements. If the optional argument @var{fill} is given, all entries in the vector will be set to @var{fill}. The default value for @var{fill} is the @@ -4613,13 +5089,14 @@ empty list. @end deffn list->weak-vector -@deffn primitive list->weak-vector +@deffn {Scheme Procedure} list->weak-vector implemented by the C function "scm_weak_vector" @end deffn weak-vector -@deffn primitive weak-vector . l -@deffnx primitive list->weak-vector l +@deffn {Scheme Procedure} weak-vector . l +@deffnx {Scheme Procedure} list->weak-vector l +@deffnx {C Function} scm_weak_vector (l) Construct a weak vector from a list: @code{weak-vector} uses the list of its arguments while @code{list->weak-vector} uses its only argument @var{l} (a list) to construct a weak vector @@ -4627,15 +5104,17 @@ the same way @code{list->vector} would. @end deffn weak-vector? -@deffn primitive weak-vector? obj +@deffn {Scheme Procedure} weak-vector? obj +@deffnx {C Function} scm_weak_vector_p (obj) Return @code{#t} if @var{obj} is a weak vector. Note that all weak hashes are also weak vectors. @end deffn make-weak-key-hash-table -@deffn primitive make-weak-key-hash-table size -@deffnx primitive make-weak-value-hash-table size -@deffnx primitive make-doubly-weak-hash-table size +@deffn {Scheme Procedure} make-weak-key-hash-table size +@deffnx {Scheme Procedure} make-weak-value-hash-table size +@deffnx {Scheme Procedure} make-doubly-weak-hash-table size +@deffnx {C Function} scm_make_weak_key_hash_table (size) Return a weak hash table with @var{size} buckets. As with any hash table, choosing a good size for the table requires some caution. @@ -4645,44 +5124,51 @@ would modify regular hash tables. (@pxref{Hash Tables}) @end deffn make-weak-value-hash-table -@deffn primitive make-weak-value-hash-table size +@deffn {Scheme Procedure} make-weak-value-hash-table size +@deffnx {C Function} scm_make_weak_value_hash_table (size) Return a hash table with weak values with @var{size} buckets. (@pxref{Hash Tables}) @end deffn make-doubly-weak-hash-table -@deffn primitive make-doubly-weak-hash-table size +@deffn {Scheme Procedure} make-doubly-weak-hash-table size +@deffnx {C Function} scm_make_doubly_weak_hash_table (size) Return a hash table with weak keys and values with @var{size} buckets. (@pxref{Hash Tables}) @end deffn weak-key-hash-table? -@deffn primitive weak-key-hash-table? obj -@deffnx primitive weak-value-hash-table? obj -@deffnx primitive doubly-weak-hash-table? obj +@deffn {Scheme Procedure} weak-key-hash-table? obj +@deffnx {Scheme Procedure} weak-value-hash-table? obj +@deffnx {Scheme Procedure} doubly-weak-hash-table? obj +@deffnx {C Function} scm_weak_key_hash_table_p (obj) Return @code{#t} if @var{obj} is the specified weak hash table. Note that a doubly weak hash table is neither a weak key nor a weak value hash table. @end deffn weak-value-hash-table? -@deffn primitive weak-value-hash-table? obj +@deffn {Scheme Procedure} weak-value-hash-table? obj +@deffnx {C Function} scm_weak_value_hash_table_p (obj) Return @code{#t} if @var{obj} is a weak value hash table. @end deffn doubly-weak-hash-table? -@deffn primitive doubly-weak-hash-table? obj +@deffn {Scheme Procedure} doubly-weak-hash-table? obj +@deffnx {C Function} scm_doubly_weak_hash_table_p (obj) Return @code{#t} if @var{obj} is a doubly weak hash table. @end deffn regexp? -@deffn primitive regexp? obj +@deffn {Scheme Procedure} regexp? obj +@deffnx {C Function} scm_regexp_p (obj) Return @code{#t} if @var{obj} is a compiled regular expression, or @code{#f} otherwise. @end deffn make-regexp -@deffn primitive make-regexp pat . flags +@deffn {Scheme Procedure} make-regexp pat . flags +@deffnx {C Function} scm_make_regexp (pat, flags) Compile the regular expression described by @var{pat}, and return the compiled regexp structure. If @var{pat} does not describe a legal regular expression, @code{make-regexp} throws @@ -4723,7 +5209,8 @@ one which comes last will override the earlier one. @end deffn regexp-exec -@deffn primitive regexp-exec rx str [start [flags]] +@deffn {Scheme Procedure} regexp-exec rx str [start [flags]] +@deffnx {C Function} scm_regexp_exec (rx, str, start, flags) Match the compiled regular expression @var{rx} against @code{str}. If the optional integer @var{start} argument is provided, begin matching from that position in the string. @@ -4746,33 +5233,36 @@ considered the end of a line. @end deffn array-fill! -@deffn primitive array-fill! ra fill -Stores @var{fill} in every element of @var{array}. The value returned +@deffn {Scheme Procedure} array-fill! ra fill +@deffnx {C Function} scm_array_fill_x (ra, fill) +Store @var{fill} in every element of @var{array}. The value returned is unspecified. @end deffn array-copy-in-order! -@deffn primitive array-copy-in-order! +@deffn {Scheme Procedure} array-copy-in-order! implemented by the C function "scm_array_copy_x" @end deffn array-copy! -@deffn primitive array-copy! src dst -@deffnx primitive array-copy-in-order! src dst -Copies every element from vector or array @var{source} to the +@deffn {Scheme Procedure} array-copy! src dst +@deffnx {Scheme Procedure} array-copy-in-order! src dst +@deffnx {C Function} scm_array_copy_x (src, dst) +Copy every element from vector or array @var{source} to the corresponding element of @var{destination}. @var{destination} must have the same rank as @var{source}, and be at least as large in each dimension. The order is unspecified. @end deffn array-map-in-order! -@deffn primitive array-map-in-order! +@deffn {Scheme Procedure} array-map-in-order! implemented by the C function "scm_array_map_x" @end deffn array-map! -@deffn primitive array-map! ra0 proc . lra -@deffnx primitive array-map-in-order! ra0 proc . lra +@deffn {Scheme Procedure} array-map! ra0 proc . lra +@deffnx {Scheme Procedure} array-map-in-order! ra0 proc . lra +@deffnx {C Function} scm_array_map_x (ra0, proc, lra) @var{array1}, @dots{} must have the same number of dimensions as @var{array0} and have a range for each index which includes the range for the corresponding index in @var{array0}. @var{proc} is applied to @@ -4782,14 +5272,16 @@ unspecified. The order of application is unspecified. @end deffn array-for-each -@deffn primitive array-for-each proc ra0 . lra -@var{proc} is applied to each tuple of elements of @var{array0} @dots{} +@deffn {Scheme Procedure} array-for-each proc ra0 . lra +@deffnx {C Function} scm_array_for_each (proc, ra0, lra) +Apply @var{proc} to each tuple of elements of @var{array0} @dots{} in row-major order. The value returned is unspecified. @end deffn array-index-map! -@deffn primitive array-index-map! ra proc -applies @var{proc} to the indices of each element of @var{array} in +@deffn {Scheme Procedure} array-index-map! ra proc +@deffnx {C Function} scm_array_index_map_x (ra, proc) +Apply @var{proc} to the indices of each element of @var{array} in turn, storing the result in the corresponding element. The value returned and the order of application are unspecified. @@ -4810,25 +5302,29 @@ Another example: @end deffn uniform-vector-length -@deffn primitive uniform-vector-length v +@deffn {Scheme Procedure} uniform-vector-length v +@deffnx {C Function} scm_uniform_vector_length (v) Return the number of elements in @var{uve}. @end deffn array? -@deffn primitive array? v [prot] +@deffn {Scheme Procedure} array? v [prot] +@deffnx {C Function} scm_array_p (v, prot) Return @code{#t} if the @var{obj} is an array, and @code{#f} if not. The @var{prototype} argument is used with uniform arrays and is described elsewhere. @end deffn array-rank -@deffn primitive array-rank ra +@deffn {Scheme Procedure} array-rank ra +@deffnx {C Function} scm_array_rank (ra) Return the number of dimensions of @var{obj}. If @var{obj} is not an array, @code{0} is returned. @end deffn array-dimensions -@deffn primitive array-dimensions ra +@deffn {Scheme Procedure} array-dimensions ra +@deffnx {C Function} scm_array_dimensions (ra) @code{Array-dimensions} is similar to @code{array-shape} but replaces elements with a @code{0} minimum with one greater than the maximum. So: @lisp @@ -4837,23 +5333,27 @@ elements with a @code{0} minimum with one greater than the maximum. So: @end deffn shared-array-root -@deffn primitive shared-array-root ra +@deffn {Scheme Procedure} shared-array-root ra +@deffnx {C Function} scm_shared_array_root (ra) Return the root vector of a shared array. @end deffn shared-array-offset -@deffn primitive shared-array-offset ra +@deffn {Scheme Procedure} shared-array-offset ra +@deffnx {C Function} scm_shared_array_offset (ra) Return the root vector index of the first element in the array. @end deffn shared-array-increments -@deffn primitive shared-array-increments ra +@deffn {Scheme Procedure} shared-array-increments ra +@deffnx {C Function} scm_shared_array_increments (ra) For each dimension, return the distance between elements in the root vector. @end deffn dimensions->uniform-array -@deffn primitive dimensions->uniform-array dims prot [fill] -@deffnx primitive make-uniform-vector length prototype [fill] +@deffn {Scheme Procedure} dimensions->uniform-array dims prot [fill] +@deffnx {Scheme Procedure} make-uniform-vector length prototype [fill] +@deffnx {C Function} scm_dimensions_to_uniform_array (dims, prot, fill) Create and return a uniform array or vector of type corresponding to @var{prototype} with dimensions @var{dims} or length @var{length}. If @var{fill} is supplied, it's used to @@ -4861,7 +5361,8 @@ fill the array, otherwise @var{prototype} is used. @end deffn make-shared-array -@deffn primitive make-shared-array oldra mapfunc . dims +@deffn {Scheme Procedure} make-shared-array oldra mapfunc . dims +@deffnx {C Function} scm_make_shared_array (oldra, mapfunc, dims) @code{make-shared-array} can be used to create shared subarrays of other arrays. The @var{mapper} is a function that translates coordinates in the new array into coordinates in the old array. A @var{mapper} must be @@ -4880,7 +5381,8 @@ it can be otherwise arbitrary. A simple example: @end deffn transpose-array -@deffn primitive transpose-array ra . args +@deffn {Scheme Procedure} transpose-array ra . args +@deffnx {C Function} scm_transpose_array (ra, args) Return an array sharing contents with @var{array}, but with dimensions arranged in a different order. There must be one @var{dim} argument for each dimension of @var{array}. @@ -4903,7 +5405,8 @@ have smaller rank than @var{array}. @end deffn enclose-array -@deffn primitive enclose-array ra . axes +@deffn {Scheme Procedure} enclose-array ra . axes +@deffnx {C Function} scm_enclose_array (ra, axes) @var{dim0}, @var{dim1} @dots{} should be nonnegative integers less than the rank of @var{array}. @var{enclose-array} returns an array resembling an array of shared arrays. The dimensions of each shared @@ -4928,38 +5431,41 @@ examples: @end deffn array-in-bounds? -@deffn primitive array-in-bounds? v . args +@deffn {Scheme Procedure} array-in-bounds? v . args +@deffnx {C Function} scm_array_in_bounds_p (v, args) Return @code{#t} if its arguments would be acceptable to @code{array-ref}. @end deffn array-ref -@deffn primitive array-ref +@deffn {Scheme Procedure} array-ref implemented by the C function "scm_uniform_vector_ref" @end deffn uniform-vector-ref -@deffn primitive uniform-vector-ref v args -@deffnx primitive array-ref v . args +@deffn {Scheme Procedure} uniform-vector-ref v args +@deffnx {Scheme Procedure} array-ref v . args +@deffnx {C Function} scm_uniform_vector_ref (v, args) Return the element at the @code{(index1, index2)} element in @var{array}. @end deffn uniform-array-set1! -@deffn primitive uniform-array-set1! +@deffn {Scheme Procedure} uniform-array-set1! implemented by the C function "scm_array_set_x" @end deffn array-set! -@deffn primitive array-set! v obj . args -@deffnx primitive uniform-array-set1! v obj args -Sets the element at the @code{(index1, index2)} element in @var{array} to +@deffn {Scheme Procedure} array-set! v obj . args +@deffnx {Scheme Procedure} uniform-array-set1! v obj args +@deffnx {C Function} scm_array_set_x (v, obj, args) +Set the element at the @code{(index1, index2)} element in @var{array} to @var{new-value}. The value returned by array-set! is unspecified. @end deffn array-contents -@deffn primitive array-contents ra [strict] -@deffnx primitive array-contents array strict +@deffn {Scheme Procedure} array-contents ra [strict] +@deffnx {C Function} scm_array_contents (ra, strict) If @var{array} may be @dfn{unrolled} into a one dimensional shared array without changing their order (last subscript changing fastest), then @code{array-contents} returns that shared array, otherwise it returns @@ -4973,12 +5479,13 @@ memory. @end deffn uniform-array-read! -@deffn primitive uniform-array-read! ra [port_or_fd [start [end]]] -@deffnx primitive uniform-vector-read! uve [port-or-fdes] [start] [end] -Attempts to read all elements of @var{ura}, in lexicographic order, as +@deffn {Scheme Procedure} uniform-array-read! ra [port_or_fd [start [end]]] +@deffnx {Scheme Procedure} uniform-vector-read! uve [port-or-fdes] [start] [end] +@deffnx {C Function} scm_uniform_array_read_x (ra, port_or_fd, start, end) +Attempt to read all elements of @var{ura}, in lexicographic order, as binary objects from @var{port-or-fdes}. -If an end of file is encountered during -uniform-array-read! the objects up to that point only are put into @var{ura} +If an end of file is encountered, +the objects up to that point are put into @var{ura} (starting at the beginning) and the remainder of the array is unchanged. @@ -4992,8 +5499,9 @@ returned by @code{(current-input-port)}. @end deffn uniform-array-write -@deffn primitive uniform-array-write v [port_or_fd [start [end]]] -@deffnx primitive uniform-vector-write uve [port-or-fdes] [start] [end] +@deffn {Scheme Procedure} uniform-array-write v [port_or_fd [start [end]]] +@deffnx {Scheme Procedure} uniform-vector-write uve [port-or-fdes] [start] [end] +@deffnx {C Function} scm_uniform_array_write (v, port_or_fd, start, end) Writes all elements of @var{ura} as binary objects to @var{port-or-fdes}. @@ -5008,33 +5516,37 @@ omitted, in which case it defaults to the value returned by @end deffn bit-count -@deffn primitive bit-count b bitvector +@deffn {Scheme Procedure} bit-count b bitvector +@deffnx {C Function} scm_bit_count (b, bitvector) Return the number of occurrences of the boolean @var{b} in @var{bitvector}. @end deffn bit-position -@deffn primitive bit-position item v k +@deffn {Scheme Procedure} bit-position item v k +@deffnx {C Function} scm_bit_position (item, v, k) Return the minimum index of an occurrence of @var{bool} in @var{bv} which is at least @var{k}. If no @var{bool} occurs within the specified range @code{#f} is returned. @end deffn bit-set*! -@deffn primitive bit-set*! v kv obj +@deffn {Scheme Procedure} bit-set*! v kv obj +@deffnx {C Function} scm_bit_set_star_x (v, kv, obj) If uve is a bit-vector @var{bv} and uve must be of the same length. If @var{bool} is @code{#t}, uve is OR'ed into @var{bv}; If @var{bool} is @code{#f}, the inversion of uve is AND'ed into @var{bv}. -If uve is a unsigned integer vector all the elements of uve +If uve is a unsigned long integer vector all the elements of uve must be between 0 and the @code{length} of @var{bv}. The bits of @var{bv} corresponding to the indexes in uve are set to @var{bool}. The return value is unspecified. @end deffn bit-count* -@deffn primitive bit-count* v kv obj +@deffn {Scheme Procedure} bit-count* v kv obj +@deffnx {C Function} scm_bit_count_star (v, kv, obj) Return @lisp (bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t). @@ -5043,19 +5555,22 @@ Return @end deffn bit-invert! -@deffn primitive bit-invert! v -Modifies @var{bv} by replacing each element with its negation. +@deffn {Scheme Procedure} bit-invert! v +@deffnx {C Function} scm_bit_invert_x (v) +Modify @var{bv} by replacing each element with its negation. @end deffn array->list -@deffn primitive array->list v +@deffn {Scheme Procedure} array->list v +@deffnx {C Function} scm_t_arrayo_list (v) Return a list consisting of all the elements, in order, of @var{array}. @end deffn list->uniform-array -@deffn primitive list->uniform-array ndim prot lst -@deffnx procedure list->uniform-vector prot lst +@deffn {Scheme Procedure} list->uniform-array ndim prot lst +@deffnx {Scheme Procedure} list->uniform-vector prot lst +@deffnx {C Function} scm_list_to_uniform_array (ndim, prot, lst) Return a uniform array of the type indicated by prototype @var{prot} with elements the same as those of @var{lst}. Elements must be of the appropriate type, no coercions are @@ -5063,14 +5578,16 @@ done. @end deffn array-prototype -@deffn primitive array-prototype ra +@deffn {Scheme Procedure} array-prototype ra +@deffnx {C Function} scm_array_prototype (ra) Return an object that would produce an array of the same type as @var{array}, if used as the @var{prototype} for @code{make-uniform-array}. @end deffn chown -@deffn primitive chown object owner group +@deffn {Scheme Procedure} chown object owner group +@deffnx {C Function} scm_chown (object, owner, group) Change the ownership and group of the file referred to by @var{object} to the integer values @var{owner} and @var{group}. @var{object} can be a string containing a file name or, if the platform @@ -5086,7 +5603,8 @@ as @code{-1}, then that ID is not changed. @end deffn chmod -@deffn primitive chmod object mode +@deffn {Scheme Procedure} chmod object mode +@deffnx {C Function} scm_chmod (object, mode) Changes the permissions of the file referred to by @var{obj}. @var{obj} can be a string containing a file name or a port or integer file descriptor which is open on a file (in which case @code{fchmod} is used @@ -5097,7 +5615,8 @@ The return value is unspecified. @end deffn umask -@deffn primitive umask [mode] +@deffn {Scheme Procedure} umask [mode] +@deffnx {C Function} scm_umask (mode) If @var{mode} is omitted, retuns a decimal number representing the current file creation mask. Otherwise the file creation mask is set to @var{mode} and the previous value is returned. @@ -5106,13 +5625,15 @@ E.g., @code{(umask #o022)} sets the mask to octal 22, decimal 18. @end deffn open-fdes -@deffn primitive open-fdes path flags [mode] +@deffn {Scheme Procedure} open-fdes path flags [mode] +@deffnx {C Function} scm_open_fdes (path, flags, mode) Similar to @code{open} but return a file descriptor instead of a port. @end deffn open -@deffn primitive open path flags [mode] +@deffn {Scheme Procedure} open path flags [mode] +@deffnx {C Function} scm_open (path, flags, mode) Open the file named by @var{path} for reading and/or writing. @var{flags} is an integer specifying how the file should be opened. @var{mode} is an integer specifying the permission bits of the file, if @@ -5143,8 +5664,9 @@ for additional flags. @end deffn close -@deffn primitive close fd_or_port -Similar to close-port (@pxref{Generic Port Operations, close-port}), +@deffn {Scheme Procedure} close fd_or_port +@deffnx {C Function} scm_close (fd_or_port) +Similar to close-port (@pxref{Closing, close-port}), but also works on file descriptors. A side effect of closing a file descriptor is that any ports using that file descriptor are moved to a different file descriptor and have @@ -5152,7 +5674,8 @@ their revealed counts set to zero. @end deffn close-fdes -@deffn primitive close-fdes fd +@deffn {Scheme Procedure} close-fdes fd +@deffnx {C Function} scm_close_fdes (fd) A simple wrapper for the @code{close} system call. Close file descriptor @var{fd}, which must be an integer. Unlike close (@pxref{Ports and File Descriptors, close}), @@ -5161,7 +5684,8 @@ The return value is unspecified. @end deffn stat -@deffn primitive stat object +@deffn {Scheme Procedure} stat object +@deffnx {C Function} scm_stat (object) Return an object containing various information about the file determined by @var{obj}. @var{obj} can be a string containing a file name or a port or integer file descriptor which is open @@ -5221,7 +5745,8 @@ An integer representing the access permission bits. @end deffn link -@deffn primitive link oldpath newpath +@deffn {Scheme Procedure} link oldpath newpath +@deffnx {C Function} scm_link (oldpath, newpath) Creates a new name @var{newpath} in the file system for the file named by @var{oldpath}. If @var{oldpath} is a symbolic link, the link may or may not be followed depending on the @@ -5229,18 +5754,21 @@ system. @end deffn rename-file -@deffn primitive rename-file oldname newname +@deffn {Scheme Procedure} rename-file oldname newname +@deffnx {C Function} scm_rename (oldname, newname) Renames the file specified by @var{oldname} to @var{newname}. The return value is unspecified. @end deffn delete-file -@deffn primitive delete-file str +@deffn {Scheme Procedure} delete-file str +@deffnx {C Function} scm_delete_file (str) Deletes (or "unlinks") the file specified by @var{path}. @end deffn mkdir -@deffn primitive mkdir path [mode] +@deffn {Scheme Procedure} mkdir path [mode] +@deffnx {C Function} scm_mkdir (path, mode) Create a new directory named by @var{path}. If @var{mode} is omitted then the permissions of the directory file are set using the current umask. Otherwise they are set to the decimal value specified with @@ -5248,55 +5776,64 @@ umask. Otherwise they are set to the decimal value specified with @end deffn rmdir -@deffn primitive rmdir path +@deffn {Scheme Procedure} rmdir path +@deffnx {C Function} scm_rmdir (path) Remove the existing directory named by @var{path}. The directory must be empty for this to succeed. The return value is unspecified. @end deffn directory-stream? -@deffn primitive directory-stream? obj +@deffn {Scheme Procedure} directory-stream? obj +@deffnx {C Function} scm_directory_stream_p (obj) Return a boolean indicating whether @var{object} is a directory stream as returned by @code{opendir}. @end deffn opendir -@deffn primitive opendir dirname +@deffn {Scheme Procedure} opendir dirname +@deffnx {C Function} scm_opendir (dirname) Open the directory specified by @var{path} and return a directory stream. @end deffn readdir -@deffn primitive readdir port +@deffn {Scheme Procedure} readdir port +@deffnx {C Function} scm_readdir (port) Return (as a string) the next directory entry from the directory stream @var{stream}. If there is no remaining entry to be read then the end of file object is returned. @end deffn rewinddir -@deffn primitive rewinddir port +@deffn {Scheme Procedure} rewinddir port +@deffnx {C Function} scm_rewinddir (port) Reset the directory port @var{stream} so that the next call to @code{readdir} will return the first directory entry. @end deffn closedir -@deffn primitive closedir port +@deffn {Scheme Procedure} closedir port +@deffnx {C Function} scm_closedir (port) Close the directory stream @var{stream}. The return value is unspecified. @end deffn chdir -@deffn primitive chdir str +@deffn {Scheme Procedure} chdir str +@deffnx {C Function} scm_chdir (str) Change the current working directory to @var{path}. The return value is unspecified. @end deffn getcwd -@deffn primitive getcwd +@deffn {Scheme Procedure} getcwd +@deffnx {C Function} scm_getcwd () Return the name of the current working directory. @end deffn select -@deffn primitive select reads writes excepts [secs [usecs]] +@deffn {Scheme Procedure} select reads writes excepts [secs [usecs]] +@deffnx {C Function} scm_select (reads, writes, excepts, secs, usecs) This procedure has a variety of uses: waiting for the ability to provide input, accept output, or the existance of exceptional conditions on a collection of ports or file @@ -5329,7 +5866,8 @@ An additional @code{select!} interface is provided. @end deffn fcntl -@deffn primitive fcntl object cmd [value] +@deffn {Scheme Procedure} fcntl object cmd [value] +@deffnx {C Function} scm_fcntl (object, cmd, value) Apply @var{command} to the specified file descriptor or the underlying file descriptor of the specified port. @var{value} is an optional integer argument. @@ -5358,7 +5896,8 @@ The value used to indicate the "close on exec" flag with @code{F_GETFL} or @end deffn fsync -@deffn primitive fsync object +@deffn {Scheme Procedure} fsync object +@deffnx {C Function} scm_fsync (object) Copies any unwritten data for the specified output file descriptor to disk. If @var{port/fd} is a port, its buffer is flushed before the underlying file descriptor is fsync'd. @@ -5366,39 +5905,45 @@ The return value is unspecified. @end deffn symlink -@deffn primitive symlink oldpath newpath +@deffn {Scheme Procedure} symlink oldpath newpath +@deffnx {C Function} scm_symlink (oldpath, newpath) Create a symbolic link named @var{path-to} with the value (i.e., pointing to) @var{path-from}. The return value is unspecified. @end deffn readlink -@deffn primitive readlink path +@deffn {Scheme Procedure} readlink path +@deffnx {C Function} scm_readlink (path) Return the value of the symbolic link named by @var{path} (a string), i.e., the file that the link points to. @end deffn lstat -@deffn primitive lstat str +@deffn {Scheme Procedure} lstat str +@deffnx {C Function} scm_lstat (str) Similar to @code{stat}, but does not follow symbolic links, i.e., it will return information about a symbolic link itself, not the file it points to. @var{path} must be a string. @end deffn copy-file -@deffn primitive copy-file oldfile newfile +@deffn {Scheme Procedure} copy-file oldfile newfile +@deffnx {C Function} scm_copy_file (oldfile, newfile) Copy the file specified by @var{path-from} to @var{path-to}. The return value is unspecified. @end deffn dirname -@deffn primitive dirname filename +@deffn {Scheme Procedure} dirname filename +@deffnx {C Function} scm_dirname (filename) Return the directory name component of the file name @var{filename}. If @var{filename} does not contain a directory component, @code{.} is returned. @end deffn basename -@deffn primitive basename filename [suffix] +@deffn {Scheme Procedure} basename filename [suffix] +@deffnx {C Function} scm_basename (filename, suffix) Return the base name of the file name @var{filename}. The base name is the file name without any directory components. If @var{suffix} is privided, and is equal to the end of @@ -5406,7 +5951,8 @@ If @var{suffix} is privided, and is equal to the end of @end deffn pipe -@deffn primitive pipe +@deffn {Scheme Procedure} pipe +@deffnx {C Function} scm_pipe () Return a newly created pipe: a pair of ports which are linked together on the local machine. The @emph{car} is the input port and the @emph{cdr} is the output port. Data written (and @@ -5423,41 +5969,47 @@ from the input port. @end deffn getgroups -@deffn primitive getgroups +@deffn {Scheme Procedure} getgroups +@deffnx {C Function} scm_getgroups () Return a vector of integers representing the current supplimentary group IDs. @end deffn getpw -@deffn primitive getpw [user] +@deffn {Scheme Procedure} getpw [user] +@deffnx {C Function} scm_getpwuid (user) Look up an entry in the user database. @var{obj} can be an integer, a string, or omitted, giving the behaviour of getpwuid, getpwnam or getpwent respectively. @end deffn setpw -@deffn primitive setpw [arg] +@deffn {Scheme Procedure} setpw [arg] +@deffnx {C Function} scm_setpwent (arg) If called with a true argument, initialize or reset the password data stream. Otherwise, close the stream. The @code{setpwent} and @code{endpwent} procedures are implemented on top of this. @end deffn getgr -@deffn primitive getgr [name] +@deffn {Scheme Procedure} getgr [name] +@deffnx {C Function} scm_getgrgid (name) Look up an entry in the group database. @var{obj} can be an integer, a string, or omitted, giving the behaviour of getgrgid, getgrnam or getgrent respectively. @end deffn setgr -@deffn primitive setgr [arg] +@deffn {Scheme Procedure} setgr [arg] +@deffnx {C Function} scm_setgrent (arg) If called with a true argument, initialize or reset the group data stream. Otherwise, close the stream. The @code{setgrent} and @code{endgrent} procedures are implemented on top of this. @end deffn kill -@deffn primitive kill pid sig +@deffn {Scheme Procedure} kill pid sig +@deffnx {C Function} scm_kill (pid, sig) Sends a signal to the specified process or group of processes. @var{pid} specifies the processes to which the signal is sent: @@ -5488,7 +6040,8 @@ Interrupt signal. @end deffn waitpid -@deffn primitive waitpid pid [options] +@deffn {Scheme Procedure} waitpid pid [options] +@deffnx {C Function} scm_waitpid (pid, options) This procedure collects status information from a child process which has terminated or (optionally) stopped. Normally it will suspend the calling process until this can be done. If more than one @@ -5533,42 +6086,49 @@ The integer status value. @end deffn status:exit-val -@deffn primitive status:exit-val status +@deffn {Scheme Procedure} status:exit-val status +@deffnx {C Function} scm_status_exit_val (status) Return the exit status value, as would be set if a process ended normally through a call to @code{exit} or @code{_exit}, if any, otherwise @code{#f}. @end deffn status:term-sig -@deffn primitive status:term-sig status +@deffn {Scheme Procedure} status:term-sig status +@deffnx {C Function} scm_status_term_sig (status) Return the signal number which terminated the process, if any, otherwise @code{#f}. @end deffn status:stop-sig -@deffn primitive status:stop-sig status +@deffn {Scheme Procedure} status:stop-sig status +@deffnx {C Function} scm_status_stop_sig (status) Return the signal number which stopped the process, if any, otherwise @code{#f}. @end deffn getppid -@deffn primitive getppid +@deffn {Scheme Procedure} getppid +@deffnx {C Function} scm_getppid () Return an integer representing the process ID of the parent process. @end deffn getuid -@deffn primitive getuid +@deffn {Scheme Procedure} getuid +@deffnx {C Function} scm_getuid () Return an integer representing the current real user ID. @end deffn getgid -@deffn primitive getgid +@deffn {Scheme Procedure} getgid +@deffnx {C Function} scm_getgid () Return an integer representing the current real group ID. @end deffn geteuid -@deffn primitive geteuid +@deffn {Scheme Procedure} geteuid +@deffnx {C Function} scm_geteuid () Return an integer representing the current effective user ID. If the system does not support effective IDs, then the real ID is returned. @code{(feature? 'EIDs)} reports whether the @@ -5576,7 +6136,8 @@ system supports effective IDs. @end deffn getegid -@deffn primitive getegid +@deffn {Scheme Procedure} getegid +@deffnx {C Function} scm_getegid () Return an integer representing the current effective group ID. If the system does not support effective IDs, then the real ID is returned. @code{(feature? 'EIDs)} reports whether the @@ -5584,21 +6145,24 @@ system supports effective IDs. @end deffn setuid -@deffn primitive setuid id +@deffn {Scheme Procedure} setuid id +@deffnx {C Function} scm_setuid (id) Sets both the real and effective user IDs to the integer @var{id}, provided the process has appropriate privileges. The return value is unspecified. @end deffn setgid -@deffn primitive setgid id +@deffn {Scheme Procedure} setgid id +@deffnx {C Function} scm_setgid (id) Sets both the real and effective group IDs to the integer @var{id}, provided the process has appropriate privileges. The return value is unspecified. @end deffn seteuid -@deffn primitive seteuid id +@deffn {Scheme Procedure} seteuid id +@deffnx {C Function} scm_seteuid (id) Sets the effective user ID to the integer @var{id}, provided the process has appropriate privileges. If effective IDs are not supported, the real ID is set instead -- @code{(feature? 'EIDs)} reports whether the @@ -5607,7 +6171,8 @@ The return value is unspecified. @end deffn setegid -@deffn primitive setegid id +@deffn {Scheme Procedure} setegid id +@deffnx {C Function} scm_setegid (id) Sets the effective group ID to the integer @var{id}, provided the process has appropriate privileges. If effective IDs are not supported, the real ID is set instead -- @code{(feature? 'EIDs)} reports whether the @@ -5616,13 +6181,15 @@ The return value is unspecified. @end deffn getpgrp -@deffn primitive getpgrp +@deffn {Scheme Procedure} getpgrp +@deffnx {C Function} scm_getpgrp () Return an integer representing the current process group ID. This is the POSIX definition, not BSD. @end deffn setpgid -@deffn primitive setpgid pid pgid +@deffn {Scheme Procedure} setpgid pid pgid +@deffnx {C Function} scm_setpgid (pid, pgid) Move the process @var{pid} into the process group @var{pgid}. @var{pid} or @var{pgid} must be integers: they can be zero to indicate the ID of the current process. @@ -5631,7 +6198,8 @@ The return value is unspecified. @end deffn setsid -@deffn primitive setsid +@deffn {Scheme Procedure} setsid +@deffnx {C Function} scm_setsid () Creates a new session. The current process becomes the session leader and is put in a new process group. The process will be detached from its controlling terminal if it has one. @@ -5639,19 +6207,22 @@ The return value is an integer representing the new process group ID. @end deffn ttyname -@deffn primitive ttyname port +@deffn {Scheme Procedure} ttyname port +@deffnx {C Function} scm_ttyname (port) Return a string with the name of the serial terminal device underlying @var{port}. @end deffn ctermid -@deffn primitive ctermid +@deffn {Scheme Procedure} ctermid +@deffnx {C Function} scm_ctermid () Return a string containing the file name of the controlling terminal for the current process. @end deffn tcgetpgrp -@deffn primitive tcgetpgrp port +@deffn {Scheme Procedure} tcgetpgrp port +@deffnx {C Function} scm_tcgetpgrp (port) Return the process group ID of the foreground process group associated with the terminal open on the file descriptor underlying @var{port}. @@ -5665,7 +6236,8 @@ foreground. @end deffn tcsetpgrp -@deffn primitive tcsetpgrp port pgid +@deffn {Scheme Procedure} tcsetpgrp port pgid +@deffnx {C Function} scm_tcsetpgrp (port, pgid) Set the foreground process group ID for the terminal used by the file descriptor underlying @var{port} to the integer @var{pgid}. The calling process @@ -5674,12 +6246,13 @@ controlling terminal. The return value is unspecified. @end deffn execl -@deffn primitive execl filename . args +@deffn {Scheme Procedure} execl filename . args +@deffnx {C Function} scm_execl (filename, args) Executes the file named by @var{path} as a new process image. The remaining arguments are supplied to the process; from a C program they are accessable as the @code{argv} argument to @code{main}. Conventionally the first @var{arg} is the same as @var{path}. -All arguments must be strings. +All arguments must be strings. If @var{arg} is missing, @var{path} is executed with a null argument list, which may have system-dependent side-effects. @@ -5689,7 +6262,8 @@ call, but we call it @code{execl} because of its Scheme calling interface. @end deffn execlp -@deffn primitive execlp filename . args +@deffn {Scheme Procedure} execlp filename . args +@deffnx {C Function} scm_execlp (filename, args) Similar to @code{execl}, however if @var{filename} does not contain a slash then the file to execute will be located by searching the @@ -5700,7 +6274,8 @@ call, but we call it @code{execlp} because of its Scheme calling interface. @end deffn execle -@deffn primitive execle filename env . args +@deffn {Scheme Procedure} execle filename env . args +@deffnx {C Function} scm_execle (filename, env, args) Similar to @code{execl}, but the environment of the new process is specified by @var{env}, which must be a list of strings as returned by the @code{environ} procedure. @@ -5710,7 +6285,8 @@ call, but we call it @code{execle} because of its Scheme calling interface. @end deffn primitive-fork -@deffn primitive primitive-fork +@deffn {Scheme Procedure} primitive-fork +@deffnx {C Function} scm_fork () Creates a new "child" process by duplicating the current "parent" process. In the child the return value is 0. In the parent the return value is the integer process ID of the child. @@ -5720,13 +6296,15 @@ with the scsh fork. @end deffn uname -@deffn primitive uname +@deffn {Scheme Procedure} uname +@deffnx {C Function} scm_uname () Return an object with some information about the computer system the program is running on. @end deffn environ -@deffn primitive environ [env] +@deffn {Scheme Procedure} environ [env] +@deffnx {C Function} scm_environ (env) If @var{env} is omitted, return the current environment (in the Unix sense) as a list of strings. Otherwise set the current environment, which is also the default environment for child @@ -5737,7 +6315,8 @@ then the return value is unspecified. @end deffn tmpnam -@deffn primitive tmpnam +@deffn {Scheme Procedure} tmpnam +@deffnx {C Function} scm_tmpnam () Return a name in the file system that does not match any existing file. However there is no guarantee that another process will not create the file after @code{tmpnam} is called. @@ -5746,7 +6325,8 @@ Care should be taken if opening the file, e.g., use the @end deffn mkstemp! -@deffn primitive mkstemp! tmpl +@deffn {Scheme Procedure} mkstemp! tmpl +@deffnx {C Function} scm_mkstemp (tmpl) Create a new unique file in the file system and returns a new buffered port open for reading and writing to the file. @var{tmpl} is a string specifying where the file should be @@ -5755,7 +6335,8 @@ place to return the name of the temporary file. @end deffn utime -@deffn primitive utime pathname [actime [modtime]] +@deffn {Scheme Procedure} utime pathname [actime [modtime]] +@deffnx {C Function} scm_utime (pathname, actime, modtime) @code{utime} sets the access and modification times for the file named by @var{path}. If @var{actime} or @var{modtime} is not supplied, then the current time is used. @var{actime} and @@ -5769,7 +6350,8 @@ modification time to the current time. @end deffn access? -@deffn primitive access? path how +@deffn {Scheme Procedure} access? path how +@deffnx {C Function} scm_access (path, how) Return @code{#t} if @var{path} corresponds to an existing file and the current process has the type of access specified by @var{how}, otherwise @code{#f}. @var{how} should be specified @@ -5796,12 +6378,14 @@ test for existence of the file. @end deffn getpid -@deffn primitive getpid +@deffn {Scheme Procedure} getpid +@deffnx {C Function} scm_getpid () Return an integer representing the current process ID. @end deffn putenv -@deffn primitive putenv str +@deffn {Scheme Procedure} putenv str +@deffnx {C Function} scm_putenv (str) Modifies the environment of the current process, which is also the default environment inherited by child processes. @@ -5816,7 +6400,8 @@ The return value is unspecified. @end deffn setlocale -@deffn primitive setlocale category [locale] +@deffn {Scheme Procedure} setlocale category [locale] +@deffnx {C Function} scm_setlocale (category, locale) If @var{locale} is omitted, return the current value of the specified locale category as a system-dependent string. @var{category} should be specified using the values @@ -5829,7 +6414,8 @@ the locale will be set using envirionment variables. @end deffn mknod -@deffn primitive mknod path type perms dev +@deffn {Scheme Procedure} mknod path type perms dev +@deffnx {C Function} scm_mknod (path, type, perms, dev) Creates a new special file, such as a file corresponding to a device. @var{path} specifies the name of the file. @var{type} should be one of the following symbols: @@ -5848,26 +6434,30 @@ The return value is unspecified. @end deffn nice -@deffn primitive nice incr +@deffn {Scheme Procedure} nice incr +@deffnx {C Function} scm_nice (incr) Increment the priority of the current process by @var{incr}. A higher priority value means that the process runs less often. The return value is unspecified. @end deffn sync -@deffn primitive sync +@deffn {Scheme Procedure} sync +@deffnx {C Function} scm_sync () Flush the operating system disk buffers. The return value is unspecified. @end deffn crypt -@deffn primitive crypt key salt +@deffn {Scheme Procedure} crypt key salt +@deffnx {C Function} scm_crypt (key, salt) Encrypt @var{key} using @var{salt} as the salt value to the crypt(3) library call. @end deffn chroot -@deffn primitive chroot path +@deffn {Scheme Procedure} chroot path +@deffnx {C Function} scm_chroot (path) Change the root directory to that specified in @var{path}. This directory will be used for path names beginning with @file{/}. The root directory is inherited by all children @@ -5876,21 +6466,24 @@ root directory. @end deffn getlogin -@deffn primitive getlogin +@deffn {Scheme Procedure} getlogin +@deffnx {C Function} scm_getlogin () Return a string containing the name of the user logged in on the controlling terminal of the process, or @code{#f} if this information cannot be obtained. @end deffn cuserid -@deffn primitive cuserid +@deffn {Scheme Procedure} cuserid +@deffnx {C Function} scm_cuserid () Return a string containing a user name associated with the effective user id of the process. Return @code{#f} if this information cannot be obtained. @end deffn getpriority -@deffn primitive getpriority which who +@deffn {Scheme Procedure} getpriority which who +@deffnx {C Function} scm_getpriority (which, who) Return the scheduling priority of the process, process group or user, as indicated by @var{which} and @var{who}. @var{which} is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP} @@ -5904,7 +6497,8 @@ specified processes. @end deffn setpriority -@deffn primitive setpriority which who prio +@deffn {Scheme Procedure} setpriority which who prio +@deffnx {C Function} scm_setpriority (which, who, prio) Set the scheduling priority of the process, process group or user, as indicated by @var{which} and @var{who}. @var{which} is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP} @@ -5921,7 +6515,8 @@ The return value is not specified. @end deffn getpass -@deffn primitive getpass prompt +@deffn {Scheme Procedure} getpass prompt +@deffnx {C Function} scm_getpass (prompt) Display @var{prompt} to the standard error output and read a password from @file{/dev/tty}. If this file is not accessible, it reads from standard input. The password may be @@ -5932,7 +6527,8 @@ characters is disabled. @end deffn flock -@deffn primitive flock file operation +@deffn {Scheme Procedure} flock file operation +@deffnx {C Function} scm_flock (file, operation) Apply or remove an advisory lock on an open file. @var{operation} specifies the action to be done: @table @code @@ -5953,21 +6549,24 @@ file descriptor or an open file descriptior port. @end deffn sethostname -@deffn primitive sethostname name +@deffn {Scheme Procedure} sethostname name +@deffnx {C Function} scm_sethostname (name) Set the host name of the current processor to @var{name}. May only be used by the superuser. The return value is not specified. @end deffn gethostname -@deffn primitive gethostname +@deffn {Scheme Procedure} gethostname +@deffnx {C Function} scm_gethostname () Return the host name of the current processor. @end deffn gethost -@deffn primitive gethost [host] -@deffnx procedure gethostbyname hostname -@deffnx procedure gethostbyaddr address +@deffn {Scheme Procedure} gethost [host] +@deffnx {Scheme Procedure} gethostbyname hostname +@deffnx {Scheme Procedure} gethostbyaddr address +@deffnx {C Function} scm_gethost (host) Look up a host by name or address, returning a host object. The @code{gethost} procedure will accept either a string name or an integer address; if given no arguments, it behaves like @code{gethostent} (see @@ -5980,9 +6579,10 @@ Unusual conditions may result in errors thrown to the @end deffn getnet -@deffn primitive getnet [net] -@deffnx procedure getnetbyname net-name -@deffnx procedure getnetbyaddr net-number +@deffn {Scheme Procedure} getnet [net] +@deffnx {Scheme Procedure} getnetbyname net-name +@deffnx {Scheme Procedure} getnetbyaddr net-number +@deffnx {C Function} scm_getnet (net) Look up a network by name or net number in the network database. The @var{net-name} argument must be a string, and the @var{net-number} argument must be an integer. @code{getnet} will accept either type of @@ -5991,9 +6591,10 @@ given. @end deffn getproto -@deffn primitive getproto [protocol] -@deffnx procedure getprotobyname name -@deffnx procedure getprotobynumber number +@deffn {Scheme Procedure} getproto [protocol] +@deffnx {Scheme Procedure} getprotobyname name +@deffnx {Scheme Procedure} getprotobynumber number +@deffnx {C Function} scm_getproto (protocol) Look up a network protocol by name or by number. @code{getprotobyname} takes a string argument, and @code{getprotobynumber} takes an integer argument. @code{getproto} will accept either type, behaving like @@ -6001,9 +6602,10 @@ argument. @code{getproto} will accept either type, behaving like @end deffn getserv -@deffn primitive getserv [name [protocol]] -@deffnx procedure getservbyname name protocol -@deffnx procedure getservbyport port protocol +@deffn {Scheme Procedure} getserv [name [protocol]] +@deffnx {Scheme Procedure} getservbyname name protocol +@deffnx {Scheme Procedure} getservbyport port protocol +@deffnx {C Function} scm_getserv (name, protocol) Look up a network service by name or by service number, and return a network service object. The @var{protocol} argument specifies the name of the desired protocol; if the protocol found in the network service @@ -6015,59 +6617,68 @@ as its first argument; if given no arguments, it behaves like @end deffn sethost -@deffn primitive sethost [stayopen] +@deffn {Scheme Procedure} sethost [stayopen] +@deffnx {C Function} scm_sethost (stayopen) If @var{stayopen} is omitted, this is equivalent to @code{endhostent}. Otherwise it is equivalent to @code{sethostent stayopen}. @end deffn setnet -@deffn primitive setnet [stayopen] +@deffn {Scheme Procedure} setnet [stayopen] +@deffnx {C Function} scm_setnet (stayopen) If @var{stayopen} is omitted, this is equivalent to @code{endnetent}. Otherwise it is equivalent to @code{setnetent stayopen}. @end deffn setproto -@deffn primitive setproto [stayopen] +@deffn {Scheme Procedure} setproto [stayopen] +@deffnx {C Function} scm_setproto (stayopen) If @var{stayopen} is omitted, this is equivalent to @code{endprotoent}. Otherwise it is equivalent to @code{setprotoent stayopen}. @end deffn setserv -@deffn primitive setserv [stayopen] +@deffn {Scheme Procedure} setserv [stayopen] +@deffnx {C Function} scm_setserv (stayopen) If @var{stayopen} is omitted, this is equivalent to @code{endservent}. Otherwise it is equivalent to @code{setservent stayopen}. @end deffn htons -@deffn primitive htons value +@deffn {Scheme Procedure} htons value +@deffnx {C Function} scm_htons (value) Convert a 16 bit quantity from host to network byte ordering. @var{value} is packed into 2 bytes, which are then converted and returned as a new integer. @end deffn ntohs -@deffn primitive ntohs value +@deffn {Scheme Procedure} ntohs value +@deffnx {C Function} scm_ntohs (value) Convert a 16 bit quantity from network to host byte ordering. @var{value} is packed into 2 bytes, which are then converted and returned as a new integer. @end deffn htonl -@deffn primitive htonl value +@deffn {Scheme Procedure} htonl value +@deffnx {C Function} scm_htonl (value) Convert a 32 bit quantity from host to network byte ordering. @var{value} is packed into 4 bytes, which are then converted and returned as a new integer. @end deffn ntohl -@deffn primitive ntohl value +@deffn {Scheme Procedure} ntohl value +@deffnx {C Function} scm_ntohl (value) Convert a 32 bit quantity from network to host byte ordering. @var{value} is packed into 4 bytes, which are then converted and returned as a new integer. @end deffn inet-aton -@deffn primitive inet-aton address +@deffn {Scheme Procedure} inet-aton address +@deffnx {C Function} scm_inet_aton (address) Convert an IPv4 Internet address from printable string (dotted decimal notation) to an integer. E.g., @@ -6077,7 +6688,8 @@ Convert an IPv4 Internet address from printable string @end deffn inet-ntoa -@deffn primitive inet-ntoa inetid +@deffn {Scheme Procedure} inet-ntoa inetid +@deffnx {C Function} scm_inet_ntoa (inetid) Convert an IPv4 Internet address to a printable (dotted decimal notation) string. E.g., @@ -6087,7 +6699,8 @@ Convert an IPv4 Internet address to a printable @end deffn inet-netof -@deffn primitive inet-netof address +@deffn {Scheme Procedure} inet-netof address +@deffnx {C Function} scm_inet_netof (address) Return the network number part of the given IPv4 Internet address. E.g., @@ -6097,7 +6710,8 @@ Internet address. E.g., @end deffn inet-lnaof -@deffn primitive inet-lnaof address +@deffn {Scheme Procedure} inet-lnaof address +@deffnx {C Function} scm_lnaof (address) Return the local-address-with-network part of the given IPv4 Internet address, using the obsolete class A/B/C system. E.g., @@ -6108,7 +6722,8 @@ E.g., @end deffn inet-makeaddr -@deffn primitive inet-makeaddr net lna +@deffn {Scheme Procedure} inet-makeaddr net lna +@deffnx {C Function} scm_inet_makeaddr (net, lna) Make an IPv4 Internet address by combining the network number @var{net} with the local-address-within-network number @var{lna}. E.g., @@ -6119,7 +6734,8 @@ Make an IPv4 Internet address by combining the network number @end deffn inet-pton -@deffn primitive inet-pton family address +@deffn {Scheme Procedure} inet-pton family address +@deffnx {C Function} scm_inet_pton (family, address) Convert a string containing a printable network address to an integer address. Note that unlike the C version of this function, @@ -6133,7 +6749,8 @@ the result is an integer with normal host byte ordering. @end deffn inet-ntop -@deffn primitive inet-ntop family address +@deffn {Scheme Procedure} inet-ntop family address +@deffnx {C Function} scm_inet_ntop (family, address) Convert a network address into a printable string. Note that unlike the C version of this function, the input is an integer with normal host byte ordering. @@ -6147,7 +6764,8 @@ ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff @end deffn socket -@deffn primitive socket family style proto +@deffn {Scheme Procedure} socket family style proto +@deffnx {C Function} scm_socket (family, style, proto) Return a new socket port of the type specified by @var{family}, @var{style} and @var{proto}. All three parameters are integers. Supported values for @var{family} are @@ -6164,7 +6782,8 @@ has been connected to another socket. @end deffn socketpair -@deffn primitive socketpair family style proto +@deffn {Scheme Procedure} socketpair family style proto +@deffnx {C Function} scm_socketpair (family, style, proto) Return a pair of connected (but unnamed) socket ports of the type specified by @var{family}, @var{style} and @var{proto}. Many systems support only socket pairs of the @code{AF_UNIX} @@ -6173,7 +6792,8 @@ family. Zero is likely to be the only meaningful value for @end deffn getsockopt -@deffn primitive getsockopt sock level optname +@deffn {Scheme Procedure} getsockopt sock level optname +@deffnx {C Function} scm_getsockopt (sock, level, optname) Return the value of a particular socket option for the socket port @var{sock}. @var{level} is an integer code for type of option being requested, e.g., @code{SOL_SOCKET} for @@ -6186,7 +6806,8 @@ returns a pair of integers. @end deffn setsockopt -@deffn primitive setsockopt sock level optname value +@deffn {Scheme Procedure} setsockopt sock level optname value +@deffnx {C Function} scm_setsockopt (sock, level, optname, value) Set the value of a particular socket option for the socket port @var{sock}. @var{level} is an integer code for type of option being set, e.g., @code{SOL_SOCKET} for socket-level options. @@ -6201,7 +6822,8 @@ The return value is unspecified. @end deffn shutdown -@deffn primitive shutdown sock how +@deffn {Scheme Procedure} shutdown sock how +@deffnx {C Function} scm_shutdown (sock, how) Sockets can be closed simply by using @code{close-port}. The @code{shutdown} procedure allows reception or tranmission on a connection to be shut down individually, according to the parameter @@ -6222,7 +6844,8 @@ The return value is unspecified. @end deffn connect -@deffn primitive connect sock fam address . args +@deffn {Scheme Procedure} connect sock fam address . args +@deffnx {C Function} scm_connect (sock, fam, address, args) Initiate a connection from a socket using a specified address family to the address specified by @var{address} and possibly @var{args}. @@ -6247,7 +6870,8 @@ The return value is unspecified. @end deffn bind -@deffn primitive bind sock fam address . args +@deffn {Scheme Procedure} bind sock fam address . args +@deffnx {C Function} scm_bind (sock, fam, address, args) Assign an address to the socket port @var{sock}. Generally this only needs to be done for server sockets, so they know where to look for incoming connections. A socket @@ -6294,7 +6918,8 @@ The return value is unspecified. @end deffn listen -@deffn primitive listen sock backlog +@deffn {Scheme Procedure} listen sock backlog +@deffnx {C Function} scm_listen (sock, backlog) Enable @var{sock} to accept connection requests. @var{backlog} is an integer specifying the maximum length of the queue for pending connections. @@ -6306,7 +6931,8 @@ The return value is unspecified. @end deffn accept -@deffn primitive accept sock +@deffn {Scheme Procedure} accept sock +@deffnx {C Function} scm_accept (sock) Accept a connection on a bound, listening socket. If there are no pending connections in the queue, wait until @@ -6324,14 +6950,16 @@ connection and will continue to accept new requests. @end deffn getsockname -@deffn primitive getsockname sock +@deffn {Scheme Procedure} getsockname sock +@deffnx {C Function} scm_getsockname (sock) Return the address of @var{sock}, in the same form as the object returned by @code{accept}. On many systems the address of a socket in the @code{AF_FILE} namespace cannot be read. @end deffn getpeername -@deffn primitive getpeername sock +@deffn {Scheme Procedure} getpeername sock +@deffnx {C Function} scm_getpeername (sock) Return the address that @var{sock} is connected to, in the same form as the object returned by @code{accept}. On many systems the address of a socket in the @@ -6339,7 +6967,8 @@ is connected to, in the same form as the object returned by @end deffn recv! -@deffn primitive recv! sock buf [flags] +@deffn {Scheme Procedure} recv! sock buf [flags] +@deffnx {C Function} scm_recv (sock, buf, flags) Receive data from a socket port. @var{sock} must already be bound to the address from which data is to be received. @@ -6363,7 +6992,8 @@ any unread buffered port data is ignored. @end deffn send -@deffn primitive send sock message [flags] +@deffn {Scheme Procedure} send sock message [flags] +@deffnx {C Function} scm_send (sock, message, flags) Transmit the string @var{message} on a socket port @var{sock}. @var{sock} must already be bound to a destination address. The value returned is the number of bytes transmitted -- @@ -6380,7 +7010,8 @@ any unflushed buffered port data is ignored. @end deffn recvfrom! -@deffn primitive recvfrom! sock str [flags [start [end]]] +@deffn {Scheme Procedure} recvfrom! sock str [flags [start [end]]] +@deffnx {C Function} scm_recvfrom (sock, str, flags, start, end) Return data from the socket port @var{sock} and also information about where the data was received from. @var{sock} must already be bound to the address from which @@ -6407,7 +7038,8 @@ descriptor: any unread buffered port data is ignored. @end deffn sendto -@deffn primitive sendto sock message fam address . args_and_flags +@deffn {Scheme Procedure} sendto sock message fam address . args_and_flags +@deffnx {C Function} scm_sendto (sock, message, fam, address, args_and_flags) Transmit the string @var{message} on the socket port @var{sock}. The destination address is specified using the @var{fam}, diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index 3fa2b7d7f..8236d1649 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,3 +1,19 @@ +2001-11-16 Neil Jerram <neil@ossau.uklinux.net> + + * debugging.texi, deprecated.texi, intro.texi, misc-modules.texi, + new-docstrings.texi, posix.texi, scheme-binding.texi, + scheme-control.texi, scheme-data.texi, scheme-debug.texi, + scheme-evaluation.texi, scheme-io.texi, scheme-memory.texi, + scheme-modules.texi, scheme-options.texi, scheme-procedures.texi, + scheme-scheduling.texi, scheme-translation.texi, + scheme-utility.texi, script-getopt.texi, srfi-modules.texi: Change + category for "primitive" and "procedure" @deffn's to {Scheme + Procedure}; add @deffnx lines for {C Function}s; automatic updates + from libguile docstring changes. + + * scheme-memory.texi (Garbage Collection): Removed doc for removed + `unhash-name'. + 2001-11-14 Thien-Thi Nguyen <ttn@glug.org> * scheme-procedures.texi: Spell "library" correctly. diff --git a/doc/ref/debugging.texi b/doc/ref/debugging.texi index 28607c551..045772721 100644 --- a/doc/ref/debugging.texi +++ b/doc/ref/debugging.texi @@ -117,11 +117,11 @@ function calls, each of which is called a @dfn{frame}. The programmer can learn more about the program's state at the point of interruption by inspecting and modifying these frames. -@deffn primitive stack? obj +@deffn {Scheme Procedure} stack? obj Return @code{#t} if @var{obj} is a calling stack. @end deffn -@deffn primitive make-stack +@deffn {Scheme Procedure} make-stack @end deffn @deffn syntax start-stack id exp @@ -132,48 +132,48 @@ way of artificially limiting backtraces and stack procedures, largely as a convenience to the user. @end deffn -@deffn primitive stack-id stack +@deffn {Scheme Procedure} stack-id stack Return the identifier given to @var{stack} by @code{start-stack}. @end deffn -@deffn primitive stack-ref +@deffn {Scheme Procedure} stack-ref @end deffn -@deffn primitive stack-length +@deffn {Scheme Procedure} stack-length @end deffn -@deffn primitive frame? +@deffn {Scheme Procedure} frame? @end deffn -@deffn primitive last-stack-frame +@deffn {Scheme Procedure} last-stack-frame @end deffn -@deffn primitive frame-number +@deffn {Scheme Procedure} frame-number @end deffn -@deffn primitive frame-source +@deffn {Scheme Procedure} frame-source @end deffn -@deffn primitive frame-procedure +@deffn {Scheme Procedure} frame-procedure @end deffn -@deffn primitive frame-arguments +@deffn {Scheme Procedure} frame-arguments @end deffn -@deffn primitive frame-previous +@deffn {Scheme Procedure} frame-previous @end deffn -@deffn primitive frame-next +@deffn {Scheme Procedure} frame-next @end deffn -@deffn primitive frame-real? +@deffn {Scheme Procedure} frame-real? @end deffn -@deffn primitive frame-procedure? +@deffn {Scheme Procedure} frame-procedure? @end deffn -@deffn primitive frame-evaluating-args? +@deffn {Scheme Procedure} frame-evaluating-args? @end deffn -@deffn primitive frame-overflow +@deffn {Scheme Procedure} frame-overflow @end deffn diff --git a/doc/ref/deprecated.texi b/doc/ref/deprecated.texi index e99e73819..3f423fe7f 100644 --- a/doc/ref/deprecated.texi +++ b/doc/ref/deprecated.texi @@ -38,7 +38,7 @@ substring is an object that mostly behaves just like an ordinary substring, except that it actually shares storage space with its parent string. -@deffn primitive make-shared-substring str [start [end]] +@deffn {Scheme Procedure} make-shared-substring str [start [end]] Return a shared substring of @var{str}. The arguments are the same as for the @code{substring} function: the shared substring returned includes all of the text from @var{str} between @@ -132,7 +132,7 @@ now require strings: ERROR: Wrong type argument (expecting STRINGP): /home/ @end lisp -@deffn primitive read-only-string? obj +@deffn {Scheme Procedure} read-only-string? obj Return @code{#t} if @var{obj} is either a string or a symbol, otherwise return @code{#f}. @end deffn diff --git a/doc/ref/intro.texi b/doc/ref/intro.texi index 9391a1d48..09da686c6 100644 --- a/doc/ref/intro.texi +++ b/doc/ref/intro.texi @@ -1,4 +1,4 @@ -@c $Id: intro.texi,v 1.3 2001-11-11 15:01:51 ossau Exp $ +@c $Id: intro.texi,v 1.4 2001-11-16 15:04:16 ossau Exp $ @page @@ -200,8 +200,8 @@ As another example, here is a simple replacement for the POSIX (newline) @end example -@deffn procedure command-line -@deffnx primitive program-arguments +@deffn {Scheme Procedure} command-line +@deffnx {Scheme Procedure} program-arguments Return a list of the command-line arguments passed to the currently running program. If the program invoked Guile with the @samp{-s}, @samp{-c} or @samp{--} switches, these procedures ignore everything up diff --git a/doc/ref/misc-modules.texi b/doc/ref/misc-modules.texi index 9dd6d99f0..be4f2ca46 100644 --- a/doc/ref/misc-modules.texi +++ b/doc/ref/misc-modules.texi @@ -30,7 +30,7 @@ how @code{pretty-print} will format the output, see the following: (else (if (= x 1) 2 (* x x x)))))) @end lisp -@deffn procedure pretty-print obj [port] +@deffn {Scheme Procedure} pretty-print obj [port] Print the textual representation of the Scheme object @var{obj} to @var{port}. @var{port} defaults to the current output port, if not given. @@ -76,7 +76,7 @@ The @code{format} procedure, to be found in module @code{(ice-9 format)}, can do all this, and even more. If you are a C programmer, you can think of this procedure as Guile's @code{fprintf}. -@deffn procedure format destination format-string args @dots{} +@deffn {Scheme Procedure} format destination format-string args @dots{} The first parameter is the @var{destination}, it determines where the output of @code{format} will go. diff --git a/doc/ref/new-docstrings.texi b/doc/ref/new-docstrings.texi index 02a1a4aad..65ea5a620 100644 --- a/doc/ref/new-docstrings.texi +++ b/doc/ref/new-docstrings.texi @@ -1,23 +1,27 @@ @c module (guile) -@deffn primitive environment? obj +@deffn {Scheme Procedure} environment? obj +@deffnx {C Function} scm_environment_p (obj) Return @code{#t} if @var{obj} is an environment, or @code{#f} otherwise. @end deffn -@deffn primitive environment-bound? env sym +@deffn {Scheme Procedure} environment-bound? env sym +@deffnx {C Function} scm_environment_bound_p (env, sym) Return @code{#t} if @var{sym} is bound in @var{env}, or @code{#f} otherwise. @end deffn -@deffn primitive environment-ref env sym +@deffn {Scheme Procedure} environment-ref env sym +@deffnx {C Function} scm_environment_ref (env, sym) Return the value of the location bound to @var{sym} in @var{env}. If @var{sym} is unbound in @var{env}, signal an @code{environment:unbound} error. @end deffn -@deffn primitive environment-fold env proc init +@deffn {Scheme Procedure} environment-fold env proc init +@deffnx {C Function} scm_environment_fold (env, proc, init) Iterate over all the bindings in @var{env}, accumulating some value. For each binding in @var{env}, apply @var{proc} to the symbol @@ -51,7 +55,8 @@ using environment-fold: @end lisp @end deffn -@deffn primitive environment-define env sym val +@deffn {Scheme Procedure} environment-define env sym val +@deffnx {C Function} scm_environment_define (env, sym, val) Bind @var{sym} to a new location containing @var{val} in @var{env}. If @var{sym} is already bound to another location in @var{env} and the binding is mutable, that binding is @@ -61,7 +66,8 @@ If @var{sym} is already bound in @var{env}, and the binding is immutable, signal an @code{environment:immutable-binding} error. @end deffn -@deffn primitive environment-undefine env sym +@deffn {Scheme Procedure} environment-undefine env sym +@deffnx {C Function} scm_environment_undefine (env, sym) Remove any binding for @var{sym} from @var{env}. If @var{sym} is unbound in @var{env}, do nothing. The return value is unspecified. @@ -69,7 +75,8 @@ If @var{sym} is already bound in @var{env}, and the binding is immutable, signal an @code{environment:immutable-binding} error. @end deffn -@deffn primitive environment-set! env sym val +@deffn {Scheme Procedure} environment-set! env sym val +@deffnx {C Function} scm_environment_set_x (env, sym, val) If @var{env} binds @var{sym} to some location, change that location's value to @var{val}. The return value is unspecified. @@ -79,7 +86,8 @@ to an immutable location, signal an @code{environment:immutable-location} error. @end deffn -@deffn primitive environment-cell env sym for_write +@deffn {Scheme Procedure} environment-cell env sym for_write +@deffnx {C Function} scm_environment_cell (env, sym, for_write) Return the value cell which @var{env} binds to @var{sym}, or @code{#f} if the binding does not live in a value cell. The argument @var{for-write} indicates whether the caller @@ -94,7 +102,8 @@ If you use this function, you should consider using re-bound to a new value cell, or becomes undefined. @end deffn -@deffn primitive environment-observe env proc +@deffn {Scheme Procedure} environment-observe env proc +@deffnx {C Function} scm_environment_observe (env, proc) Whenever @var{env}'s bindings change, apply @var{proc} to @var{env}. This function returns an object, token, which you can pass to @@ -103,7 +112,8 @@ of procedures observing @var{env}. The type and value of token is unspecified. @end deffn -@deffn primitive environment-observe-weak env proc +@deffn {Scheme Procedure} environment-observe-weak env proc +@deffnx {C Function} scm_environment_observe_weak (env, proc) This function is the same as environment-observe, except that the reference @var{env} retains to @var{proc} is a weak reference. This means that, if there are no other live, @@ -112,7 +122,8 @@ garbage-collected, and dropped from @var{env}'s list of observing procedures. @end deffn -@deffn primitive environment-unobserve token +@deffn {Scheme Procedure} environment-unobserve token +@deffnx {C Function} scm_environment_unobserve (token) Cancel the observation request which returned the value @var{token}. The return value is unspecified. If a call @code{(environment-observe env proc)} returns @@ -121,18 +132,21 @@ will cause @var{proc} to no longer be called when @var{env}'s bindings change. @end deffn -@deffn primitive make-leaf-environment +@deffn {Scheme Procedure} make-leaf-environment +@deffnx {C Function} scm_make_leaf_environment () Create a new leaf environment, containing no bindings. All bindings and locations created in the new environment will be mutable. @end deffn -@deffn primitive leaf-environment? object +@deffn {Scheme Procedure} leaf-environment? object +@deffnx {C Function} scm_leaf_environment_p (object) Return @code{#t} if object is a leaf environment, or @code{#f} otherwise. @end deffn -@deffn primitive make-eval-environment local imported +@deffn {Scheme Procedure} make-eval-environment local imported +@deffnx {C Function} scm_make_eval_environment (local, imported) Return a new environment object eval whose bindings are the union of the bindings in the environments @var{local} and @var{imported}, with bindings from @var{local} taking @@ -156,28 +170,34 @@ In typical use, @var{local} will be a finite environment, and @var{imported} will be an import environment @end deffn -@deffn primitive eval-environment? object +@deffn {Scheme Procedure} eval-environment? object +@deffnx {C Function} scm_eval_environment_p (object) Return @code{#t} if object is an eval environment, or @code{#f} otherwise. @end deffn -@deffn primitive eval-environment-local env +@deffn {Scheme Procedure} eval-environment-local env +@deffnx {C Function} scm_eval_environment_local (env) Return the local environment of eval environment @var{env}. @end deffn -@deffn primitive eval-environment-set-local! env local +@deffn {Scheme Procedure} eval-environment-set-local! env local +@deffnx {C Function} scm_eval_environment_set_local_x (env, local) Change @var{env}'s local environment to @var{local}. @end deffn -@deffn primitive eval-environment-imported env +@deffn {Scheme Procedure} eval-environment-imported env +@deffnx {C Function} scm_eval_environment_imported (env) Return the imported environment of eval environment @var{env}. @end deffn -@deffn primitive eval-environment-set-imported! env imported +@deffn {Scheme Procedure} eval-environment-set-imported! env imported +@deffnx {C Function} scm_eval_environment_set_imported_x (env, imported) Change @var{env}'s imported environment to @var{imported}. @end deffn -@deffn primitive make-import-environment imports conflict_proc +@deffn {Scheme Procedure} make-import-environment imports conflict_proc +@deffnx {C Function} scm_make_import_environment (imports, conflict_proc) Return a new environment @var{imp} whose bindings are the union of the bindings from the environments in @var{imports}; @var{imports} must be a list of environments. That is, @@ -205,22 +225,26 @@ notice that the set of bindings in @var{imp} may still change, if one of its imported environments changes. @end deffn -@deffn primitive import-environment? object +@deffn {Scheme Procedure} import-environment? object +@deffnx {C Function} scm_import_environment_p (object) Return @code{#t} if object is an import environment, or @code{#f} otherwise. @end deffn -@deffn primitive import-environment-imports env +@deffn {Scheme Procedure} import-environment-imports env +@deffnx {C Function} scm_import_environment_imports (env) Return the list of environments imported by the import environment @var{env}. @end deffn -@deffn primitive import-environment-set-imports! env imports +@deffn {Scheme Procedure} import-environment-set-imports! env imports +@deffnx {C Function} scm_import_environment_set_imports_x (env, imports) Change @var{env}'s list of imported environments to @var{imports}, and check for conflicts. @end deffn -@deffn primitive make-export-environment private signature +@deffn {Scheme Procedure} make-export-environment private signature +@deffnx {C Function} scm_make_export_environment (private, signature) Return a new environment @var{exp} containing only those bindings in private whose symbols are present in @var{signature}. The @var{private} argument must be an @@ -267,34 +291,41 @@ notice that the set of bindings in @var{exp} may still change, if the bindings in private change. @end deffn -@deffn primitive export-environment? object +@deffn {Scheme Procedure} export-environment? object +@deffnx {C Function} scm_export_environment_p (object) Return @code{#t} if object is an export environment, or @code{#f} otherwise. @end deffn -@deffn primitive export-environment-private env +@deffn {Scheme Procedure} export-environment-private env +@deffnx {C Function} scm_export_environment_private (env) Return the private environment of export environment @var{env}. @end deffn -@deffn primitive export-environment-set-private! env private +@deffn {Scheme Procedure} export-environment-set-private! env private +@deffnx {C Function} scm_export_environment_set_private_x (env, private) Change the private environment of export environment @var{env}. @end deffn -@deffn primitive export-environment-signature env +@deffn {Scheme Procedure} export-environment-signature env +@deffnx {C Function} scm_export_environment_signature (env) Return the signature of export environment @var{env}. @end deffn -@deffn primitive export-environment-set-signature! env signature +@deffn {Scheme Procedure} export-environment-set-signature! env signature +@deffnx {C Function} scm_export_environment_set_signature_x (env, signature) Change the signature of export environment @var{env}. @end deffn -@deffn primitive %compute-slots class +@deffn {Scheme Procedure} %compute-slots class +@deffnx {C Function} scm_sys_compute_slots (class) Return a list consisting of the names of all slots belonging to class @var{class}, i. e. the slots of @var{class} and of all of its superclasses. @end deffn -@deffn primitive get-keyword key l default_value +@deffn {Scheme Procedure} get-keyword key l default_value +@deffnx {C Function} scm_get_keyword (key, l, default_value) Determine an associated value for the keyword @var{key} from the list @var{l}. The list @var{l} has to consist of an even number of elements, where, starting with the first, every @@ -303,222 +334,271 @@ If @var{l} does not hold a value for @var{key}, the value @var{default_value} is returned. @end deffn -@deffn primitive slot-ref-using-class class obj slot_name +@deffn {Scheme Procedure} slot-ref-using-class class obj slot_name +@deffnx {C Function} scm_slot_ref_using_class (class, obj, slot_name) @end deffn -@deffn primitive slot-set-using-class! class obj slot_name value +@deffn {Scheme Procedure} slot-set-using-class! class obj slot_name value +@deffnx {C Function} scm_slot_set_using_class_x (class, obj, slot_name, value) @end deffn -@deffn primitive class-of x +@deffn {Scheme Procedure} class-of x +@deffnx {C Function} scm_class_of (x) Return the class of @var{x}. @end deffn -@deffn primitive %goops-loaded +@deffn {Scheme Procedure} %goops-loaded +@deffnx {C Function} scm_sys_goops_loaded () Announce that GOOPS is loaded and perform initialization on the C level which depends on the loaded GOOPS modules. @end deffn -@deffn primitive %method-more-specific? m1 m2 targs +@deffn {Scheme Procedure} %method-more-specific? m1 m2 targs +@deffnx {C Function} scm_sys_method_more_specific_p (m1, m2, targs) @end deffn -@deffn primitive find-method . l +@deffn {Scheme Procedure} find-method . l +@deffnx {C Function} scm_find_method (l) @end deffn -@deffn primitive primitive-generic-generic subr +@deffn {Scheme Procedure} primitive-generic-generic subr +@deffnx {C Function} scm_primitive_generic_generic (subr) @end deffn -@deffn primitive enable-primitive-generic! . subrs +@deffn {Scheme Procedure} enable-primitive-generic! . subrs +@deffnx {C Function} scm_enable_primitive_generic_x (subrs) @end deffn -@deffn primitive generic-capability? proc +@deffn {Scheme Procedure} generic-capability? proc +@deffnx {C Function} scm_generic_capability_p (proc) @end deffn -@deffn primitive %invalidate-method-cache! gf +@deffn {Scheme Procedure} %invalidate-method-cache! gf +@deffnx {C Function} scm_sys_invalidate_method_cache_x (gf) @end deffn -@deffn primitive %invalidate-class class +@deffn {Scheme Procedure} %invalidate-class class +@deffnx {C Function} scm_sys_invalidate_class (class) @end deffn -@deffn primitive %modify-class old new +@deffn {Scheme Procedure} %modify-class old new +@deffnx {C Function} scm_sys_modify_class (old, new) @end deffn -@deffn primitive %modify-instance old new +@deffn {Scheme Procedure} %modify-instance old new +@deffnx {C Function} scm_sys_modify_instance (old, new) @end deffn -@deffn primitive %set-object-setter! obj setter +@deffn {Scheme Procedure} %set-object-setter! obj setter +@deffnx {C Function} scm_sys_set_object_setter_x (obj, setter) @end deffn -@deffn primitive %allocate-instance class initargs +@deffn {Scheme Procedure} %allocate-instance class initargs +@deffnx {C Function} scm_sys_allocate_instance (class, initargs) Create a new instance of class @var{class} and initialize it from the arguments @var{initargs}. @end deffn -@deffn primitive slot-exists? obj slot_name +@deffn {Scheme Procedure} slot-exists? obj slot_name +@deffnx {C Function} scm_slots_exists_p (obj, slot_name) Return @code{#t} if @var{obj} has a slot named @var{slot_name}. @end deffn -@deffn primitive slot-bound? obj slot_name +@deffn {Scheme Procedure} slot-bound? obj slot_name +@deffnx {C Function} scm_slot_bound_p (obj, slot_name) Return @code{#t} if the slot named @var{slot_name} of @var{obj} is bound. @end deffn -@deffn primitive slot-set! obj slot_name value +@deffn {Scheme Procedure} slot-set! obj slot_name value +@deffnx {C Function} scm_slot_set_x (obj, slot_name, value) Set the slot named @var{slot_name} of @var{obj} to @var{value}. @end deffn -@deffn primitive slot-exists-using-class? class obj slot_name +@deffn {Scheme Procedure} slot-exists-using-class? class obj slot_name +@deffnx {C Function} scm_slot_exists_using_class_p (class, obj, slot_name) @end deffn -@deffn primitive slot-bound-using-class? class obj slot_name +@deffn {Scheme Procedure} slot-bound-using-class? class obj slot_name +@deffnx {C Function} scm_slot_bound_using_class_p (class, obj, slot_name) @end deffn -@deffn primitive %fast-slot-set! obj index value +@deffn {Scheme Procedure} %fast-slot-set! obj index value +@deffnx {C Function} scm_sys_fast_slot_set_x (obj, index, value) Set the slot with index @var{index} in @var{obj} to @var{value}. @end deffn -@deffn primitive %fast-slot-ref obj index +@deffn {Scheme Procedure} %fast-slot-ref obj index +@deffnx {C Function} scm_sys_fast_slot_ref (obj, index) Return the slot value with index @var{index} from @var{obj}. @end deffn -@deffn primitive @@assert-bound-ref obj index +@deffn {Scheme Procedure} @@assert-bound-ref obj index +@deffnx {C Function} scm_at_assert_bound_ref (obj, index) Like @code{assert-bound}, but use @var{index} for accessing the value from @var{obj}. @end deffn -@deffn primitive assert-bound value obj +@deffn {Scheme Procedure} assert-bound value obj +@deffnx {C Function} scm_assert_bound (value, obj) Return @var{value} if it is bound, and invoke the @var{slot-unbound} method of @var{obj} if it is not. @end deffn -@deffn primitive unbound? obj +@deffn {Scheme Procedure} unbound? obj +@deffnx {C Function} scm_unbound_p (obj) Return @code{#t} if @var{obj} is unbound. @end deffn -@deffn primitive make-unbound +@deffn {Scheme Procedure} make-unbound +@deffnx {C Function} scm_make_unbound () Return the unbound value. @end deffn -@deffn primitive accessor-method-slot-definition obj +@deffn {Scheme Procedure} accessor-method-slot-definition obj +@deffnx {C Function} scm_accessor_method_slot_definition (obj) Return the slot definition of the accessor @var{obj}. @end deffn -@deffn primitive method-procedure obj +@deffn {Scheme Procedure} method-procedure obj +@deffnx {C Function} scm_method_procedure (obj) Return the procedure of the method @var{obj}. @end deffn -@deffn primitive method-specializers obj +@deffn {Scheme Procedure} method-specializers obj +@deffnx {C Function} scm_method_specializers (obj) Return specializers of the method @var{obj}. @end deffn -@deffn primitive method-generic-function obj +@deffn {Scheme Procedure} method-generic-function obj +@deffnx {C Function} scm_method_generic_function (obj) Return the generic function fot the method @var{obj}. @end deffn -@deffn primitive generic-function-methods obj +@deffn {Scheme Procedure} generic-function-methods obj +@deffnx {C Function} scm_generic_function_methods (obj) Return the methods of the generic function @var{obj}. @end deffn -@deffn primitive generic-function-name obj +@deffn {Scheme Procedure} generic-function-name obj +@deffnx {C Function} scm_generic_function_name (obj) Return the name of the generic function @var{obj}. @end deffn -@deffn primitive class-environment obj +@deffn {Scheme Procedure} class-environment obj +@deffnx {C Function} scm_class_environment (obj) Return the environment of the class @var{obj}. @end deffn -@deffn primitive class-slots obj +@deffn {Scheme Procedure} class-slots obj +@deffnx {C Function} scm_class_slots (obj) Return the slot list of the class @var{obj}. @end deffn -@deffn primitive class-precedence-list obj +@deffn {Scheme Procedure} class-precedence-list obj +@deffnx {C Function} scm_class_precedence_list (obj) Return the class precedence list of the class @var{obj}. @end deffn -@deffn primitive class-direct-methods obj +@deffn {Scheme Procedure} class-direct-methods obj +@deffnx {C Function} scm_class_direct_methods (obj) Return the direct methods of the class @var{obj} @end deffn -@deffn primitive class-direct-subclasses obj +@deffn {Scheme Procedure} class-direct-subclasses obj +@deffnx {C Function} scm_class_direct_subclasses (obj) Return the direct subclasses of the class @var{obj}. @end deffn -@deffn primitive class-direct-slots obj +@deffn {Scheme Procedure} class-direct-slots obj +@deffnx {C Function} scm_class_direct_slots (obj) Return the direct slots of the class @var{obj}. @end deffn -@deffn primitive class-direct-supers obj +@deffn {Scheme Procedure} class-direct-supers obj +@deffnx {C Function} scm_class_direct_supers (obj) Return the direct superclasses of the class @var{obj}. @end deffn -@deffn primitive class-name obj +@deffn {Scheme Procedure} class-name obj +@deffnx {C Function} scm_class_name (obj) Return the class name of @var{obj}. @end deffn -@deffn primitive instance? obj +@deffn {Scheme Procedure} instance? obj +@deffnx {C Function} scm_instance_p (obj) Return @code{#t} if @var{obj} is an instance. @end deffn -@deffn primitive %inherit-magic! class dsupers +@deffn {Scheme Procedure} %inherit-magic! class dsupers +@deffnx {C Function} scm_sys_inherit_magic_x (class, dsupers) @end deffn -@deffn primitive %prep-layout! class +@deffn {Scheme Procedure} %prep-layout! class +@deffnx {C Function} scm_sys_prep_layout_x (class) @end deffn -@deffn primitive %initialize-object obj initargs +@deffn {Scheme Procedure} %initialize-object obj initargs +@deffnx {C Function} scm_sys_initialize_object (obj, initargs) Initialize the object @var{obj} with the given arguments @var{initargs}. @end deffn -@deffn primitive make . args +@deffn {Scheme Procedure} make . args +@deffnx {C Function} scm_make (args) Make a new object. @var{args} must contain the class and all necessary initialization information. @end deffn -@deffn primitive slot-ref obj slot_name +@deffn {Scheme Procedure} slot-ref obj slot_name +@deffnx {C Function} scm_slot_ref (obj, slot_name) Return the value from @var{obj}'s slot with the name @var{slot_name}. @end deffn -@deffn primitive builtin-bindings +@deffn {Scheme Procedure} builtin-bindings Create and return a copy of the global symbol table, removing all unbound symbols. @end deffn -@deffn primitive %tag-body body +@deffn {Scheme Procedure} %tag-body body +@deffnx {C Function} scm_sys_tag_body (body) Internal GOOPS magic---don't use this function! @end deffn -@deffn primitive list* +@deffn {Scheme Procedure} list* implemented by the C function "scm_cons_star" @end deffn -@deffn primitive set-current-module module +@deffn {Scheme Procedure} set-current-module module +@deffnx {C Function} scm_set_current_module (module) Set the current module to @var{module} and return the previous current module. @end deffn -@deffn primitive current-module +@deffn {Scheme Procedure} current-module +@deffnx {C Function} scm_current_module () Return the current module. @end deffn -@deffn primitive c-clear-registered-modules +@deffn {Scheme Procedure} c-clear-registered-modules Destroy the list of modules registered with the current Guile process. The return value is unspecified. @strong{Warning:} this function does not actually unlink or deallocate these modules, but only destroys the @@ -526,7 +606,7 @@ records of which modules have been loaded. It should therefore be used only by module bookkeeping operations. @end deffn -@deffn primitive c-registered-modules +@deffn {Scheme Procedure} c-registered-modules Return a list of the object code modules that have been imported into the current Guile process. Each element of the list is a pair whose car is the name of the module, and whose cdr is the function handle @@ -534,12 +614,12 @@ for that module's initializer function. The name is the string that has been passed to scm_register_module_xxx. @end deffn -@deffn primitive include-deprecated-features +@deffn {Scheme Procedure} include-deprecated-features Return @code{#t} iff deprecated features should be included in public interfaces. @end deffn -@deffn primitive issue-deprecation-warning . msgs +@deffn {Scheme Procedure} issue-deprecation-warning . msgs Output @var{msgs} to @code{(current-error-port)} when this is the first call to @code{issue-deprecation-warning} with this specific @var{msg}. Do nothing otherwise. @@ -547,23 +627,28 @@ The argument @var{msgs} should be a list of strings; they are printed in turn, each one followed by a newline. @end deffn -@deffn primitive valid-object-procedure? proc +@deffn {Scheme Procedure} valid-object-procedure? proc +@deffnx {C Function} scm_valid_object_procedure_p (proc) Return @code{#t} iff @var{proc} is a procedure that can be used with @code{set-object-procedure}. It is always valid to use a closure constructed by @code{lambda}. @end deffn -@deffn primitive %get-pre-modules-obarray +@deffn {Scheme Procedure} %get-pre-modules-obarray +@deffnx {C Function} scm_get_pre_modules_obarray () Return the obarray that is used for all new bindings before the module system is booted. The first call to @code{set-current-module} will boot the module system. @end deffn -@deffn primitive standard-interface-eval-closure module +@deffn {Scheme Procedure} standard-interface-eval-closure module +@deffnx {C Function} scm_standard_interface_eval_closure (module) Return a interface eval closure for the module @var{module}. Such a closure does not allow new bindings to be added. @end deffn -@deffn primitive env-module env +@deffn {Scheme Procedure} env-module env +@deffnx {C Function} scm_env_module (env) Return the module of @var{ENV}, a lexical environment. @end deffn -@deffn primitive load-extension lib init +@deffn {Scheme Procedure} load-extension lib init +@deffnx {C Function} scm_load_extension (lib, init) Load and initialize the extension designated by LIB and INIT. When there is no pre-registered function for LIB/INIT, this is equivalent to diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi index f2237f2c1..e2fd65873 100644 --- a/doc/ref/posix.texi +++ b/doc/ref/posix.texi @@ -145,51 +145,57 @@ one, so that dropping references to one of these ports will not result in its garbage collection: it could be retrieved with fdopen or fdes->ports. -@deffn primitive port-revealed port +@deffn {Scheme Procedure} port-revealed port +@deffnx {C Function} scm_port_revealed (port) Return the revealed count for @var{port}. @end deffn -@deffn primitive set-port-revealed! port rcount +@deffn {Scheme Procedure} set-port-revealed! port rcount +@deffnx {C Function} scm_set_port_revealed_x (port, rcount) Sets the revealed count for a port to a given value. The return value is unspecified. @end deffn -@deffn primitive fileno port +@deffn {Scheme Procedure} fileno port +@deffnx {C Function} scm_fileno (port) Return the integer file descriptor underlying @var{port}. Does not change its revealed count. @end deffn -@deffn procedure port->fdes port +@deffn {Scheme Procedure} port->fdes port Returns the integer file descriptor underlying @var{port}. As a side effect the revealed count of @var{port} is incremented. @end deffn -@deffn primitive fdopen fdes modes +@deffn {Scheme Procedure} fdopen fdes modes +@deffnx {C Function} scm_fdopen (fdes, modes) Return a new port based on the file descriptor @var{fdes}. Modes are given by the string @var{modes}. The revealed count of the port is initialized to zero. The modes string is the same as that accepted by @ref{File Ports, open-file}. @end deffn -@deffn primitive fdes->ports fd +@deffn {Scheme Procedure} fdes->ports fd +@deffnx {C Function} scm_fdes_to_ports (fd) Return a list of existing ports which have @var{fdes} as an underlying file descriptor, without changing their revealed counts. @end deffn -@deffn procedure fdes->inport fdes +@deffn {Scheme Procedure} fdes->inport fdes Returns an existing input port which has @var{fdes} as its underlying file descriptor, if one exists, and increments its revealed count. Otherwise, returns a new input port with a revealed count of 1. @end deffn -@deffn procedure fdes->outport fdes +@deffn {Scheme Procedure} fdes->outport fdes Returns an existing output port which has @var{fdes} as its underlying file descriptor, if one exists, and increments its revealed count. Otherwise, returns a new output port with a revealed count of 1. @end deffn -@deffn primitive primitive-move->fdes port fd +@deffn {Scheme Procedure} primitive-move->fdes port fd +@deffnx {C Function} scm_primitive_move_to_fdes (port, fd) Moves the underlying file descriptor for @var{port} to the integer value @var{fdes} without changing the revealed count of @var{port}. Any other ports already using this descriptor will be automatically @@ -198,7 +204,7 @@ The return value is @code{#f} if the file descriptor already had the required value or @code{#t} if it was moved. @end deffn -@deffn procedure move->fdes port fdes +@deffn {Scheme Procedure} move->fdes port fdes Moves the underlying file descriptor for @var{port} to the integer value @var{fdes} and sets its revealed count to one. Any other ports already using this descriptor will be automatically @@ -206,18 +212,20 @@ shifted to new descriptors and their revealed counts reset to zero. The return value is unspecified. @end deffn -@deffn procedure release-port-handle port +@deffn {Scheme Procedure} release-port-handle port Decrements the revealed count for a port. @end deffn -@deffn primitive fsync object +@deffn {Scheme Procedure} fsync object +@deffnx {C Function} scm_fsync (object) Copies any unwritten data for the specified output file descriptor to disk. If @var{port/fd} is a port, its buffer is flushed before the underlying file descriptor is fsync'd. The return value is unspecified. @end deffn -@deffn primitive open path flags [mode] +@deffn {Scheme Procedure} open path flags [mode] +@deffnx {C Function} scm_open (path, flags, mode) Open the file named by @var{path} for reading and/or writing. @var{flags} is an integer specifying how the file should be opened. @var{mode} is an integer specifying the permission bits of the file, if @@ -247,19 +255,23 @@ See the Unix documentation of the @code{open} system call for additional flags. @end deffn -@deffn primitive open-fdes path flags [mode] +@deffn {Scheme Procedure} open-fdes path flags [mode] +@deffnx {C Function} scm_open_fdes (path, flags, mode) Similar to @code{open} but return a file descriptor instead of a port. @end deffn -@deffn primitive close fd_or_port -Similar to close-port (@pxref{Closing, close-port}), but also works on -file descriptors. A side effect of closing a file descriptor is that -any ports using that file descriptor are moved to a different file -descriptor and have their revealed counts set to zero. +@deffn {Scheme Procedure} close fd_or_port +@deffnx {C Function} scm_close (fd_or_port) +Similar to close-port (@pxref{Closing, close-port}), +but also works on file descriptors. A side +effect of closing a file descriptor is that any ports using that file +descriptor are moved to a different file descriptor and have +their revealed counts set to zero. @end deffn -@deffn primitive close-fdes fd +@deffn {Scheme Procedure} close-fdes fd +@deffnx {C Function} scm_close_fdes (fd) A simple wrapper for the @code{close} system call. Close file descriptor @var{fd}, which must be an integer. Unlike close (@pxref{Ports and File Descriptors, close}), @@ -267,21 +279,22 @@ the file descriptor will be closed even if a port is using it. The return value is unspecified. @end deffn -@deffn primitive unread-char char [port] +@deffn {Scheme Procedure} unread-char char [port] Place @var{char} in @var{port} so that it will be read by the next read operation. If called multiple times, the unread characters will be read again in last-in first-out order. If @var{port} is not supplied, the current input port is used. @end deffn -@deffn primitive unread-string str port +@deffn {Scheme Procedure} unread-string str port Place the string @var{str} in @var{port} so that its characters will be read in subsequent read operations. If called multiple times, the unread characters will be read again in last-in first-out order. If @var{port} is not supplied, the current-input-port is used. @end deffn -@deffn primitive pipe +@deffn {Scheme Procedure} pipe +@deffnx {C Function} scm_pipe () Return a newly created pipe: a pair of ports which are linked together on the local machine. The @emph{car} is the input port and the @emph{cdr} is the output port. Data written (and @@ -307,31 +320,32 @@ All procedures also have the side effect when performing @code{dup2} that any ports using @var{newfd} are moved to a different file descriptor and have their revealed counts set to zero. -@deffn primitive dup->fdes fd_or_port [fd] +@deffn {Scheme Procedure} dup->fdes fd_or_port [fd] +@deffnx {C Function} scm_dup_to_fdes (fd_or_port, fd) Return a new integer file descriptor referring to the open file designated by @var{fd_or_port}, which must be either an open file port or a file descriptor. @end deffn -@deffn procedure dup->inport port/fd [newfd] +@deffn {Scheme Procedure} dup->inport port/fd [newfd] Returns a new input port using the new file descriptor. @end deffn -@deffn procedure dup->outport port/fd [newfd] +@deffn {Scheme Procedure} dup->outport port/fd [newfd] Returns a new output port using the new file descriptor. @end deffn -@deffn procedure dup port/fd [newfd] +@deffn {Scheme Procedure} dup port/fd [newfd] Returns a new port if @var{port/fd} is a port, with the same mode as the supplied port, otherwise returns an integer file descriptor. @end deffn -@deffn procedure dup->port port/fd mode [newfd] +@deffn {Scheme Procedure} dup->port port/fd mode [newfd] Returns a new port using the new file descriptor. @var{mode} supplies a mode string for the port (@pxref{File Ports, open-file}). @end deffn -@deffn procedure duplicate-port port modes +@deffn {Scheme Procedure} duplicate-port port modes Returns a new port which is opened on a duplicate of the file descriptor underlying @var{port}, with mode string @var{modes} as for @ref{File Ports, open-file}. The two ports @@ -345,7 +359,8 @@ port. This procedure is equivalent to @code{(dup->port @var{port} @var{modes})}. @end deffn -@deffn primitive redirect-port old new +@deffn {Scheme Procedure} redirect-port old new +@deffnx {C Function} scm_redirect_port (old, new) This procedure takes two ports and duplicates the underlying file descriptor from @var{old-port} into @var{new-port}. The current file descriptor in @var{new-port} will be closed. @@ -361,7 +376,8 @@ This procedure does not have any side effects on other ports or revealed counts. @end deffn -@deffn primitive dup2 oldfd newfd +@deffn {Scheme Procedure} dup2 oldfd newfd +@deffnx {C Function} scm_dup2 (oldfd, newfd) A simple wrapper for the @code{dup2} system call. Copies the file descriptor @var{oldfd} to descriptor number @var{newfd}, replacing the previous meaning @@ -372,14 +388,14 @@ is made to move away ports which are using @var{newfd}. The return value is unspecified. @end deffn -@deffn primitive port-mode port +@deffn {Scheme Procedure} port-mode port Return the port modes associated with the open port @var{port}. These will not necessarily be identical to the modes used when the port was opened, since modes such as "append" which are used only during port creation are not retained. @end deffn -@deffn primitive close-all-ports-except . ports +@deffn {Scheme Procedure} close-all-ports-except . ports [DEPRECATED] Close all open file ports used by the interpreter except for those supplied as arguments. This procedure was intended to be used before an exec call to close file descriptors @@ -388,7 +404,8 @@ undesirable side-effect of flushing buffes, so it's deprecated. Use port-for-each instead. @end deffn -@deffn primitive port-for-each proc +@deffn {Scheme Procedure} port-for-each proc +@deffnx {C Function} scm_port_for_each (proc) Apply @var{proc} to each port in the Guile port table in turn. The return value is unspecified. More specifically, @var{proc} is applied exactly once to every port that exists @@ -397,7 +414,8 @@ Changes to the port table while @var{port-for-each} is running have no effect as far as @var{port-for-each} is concerned. @end deffn -@deffn primitive setvbuf port mode [size] +@deffn {Scheme Procedure} setvbuf port mode [size] +@deffnx {C Function} scm_setvbuf (port, mode, size) Set the buffering mode for @var{port}. @var{mode} can be: @table @code @item _IONBF @@ -410,7 +428,8 @@ If @var{size} is omitted, a default size will be used. @end table @end deffn -@deffn primitive fcntl object cmd [value] +@deffn {Scheme Procedure} fcntl object cmd [value] +@deffnx {C Function} scm_fcntl (object, cmd, value) Apply @var{command} to the specified file descriptor or the underlying file descriptor of the specified port. @var{value} is an optional integer argument. @@ -438,7 +457,8 @@ The value used to indicate the "close on exec" flag with @code{F_GETFL} or @end table @end deffn -@deffn primitive flock file operation +@deffn {Scheme Procedure} flock file operation +@deffnx {C Function} scm_flock (file, operation) Apply or remove an advisory lock on an open file. @var{operation} specifies the action to be done: @table @code @@ -458,7 +478,8 @@ The return value is not specified. @var{file} may be an open file descriptor or an open file descriptior port. @end deffn -@deffn primitive select reads writes excepts [secs [usecs]] +@deffn {Scheme Procedure} select reads writes excepts [secs [usecs]] +@deffnx {C Function} scm_select (reads, writes, excepts, secs, usecs) This procedure has a variety of uses: waiting for the ability to provide input, accept output, or the existance of exceptional conditions on a collection of ports or file @@ -499,7 +520,8 @@ permissions, sizes and types of files); deleting, copying, renaming and linking files; creating and removing directories and querying their contents; syncing the file system and creating special files. -@deffn primitive access? path how +@deffn {Scheme Procedure} access? path how +@deffnx {C Function} scm_access (path, how) Return @code{#t} if @var{path} corresponds to an existing file and the current process has the type of access specified by @var{how}, otherwise @code{#f}. @var{how} should be specified @@ -526,7 +548,8 @@ test for existence of the file. @end deffn @findex fstat -@deffn primitive stat object +@deffn {Scheme Procedure} stat object +@deffnx {C Function} scm_stat (object) Return an object containing various information about the file determined by @var{obj}. @var{obj} can be a string containing a file name or a port or integer file descriptor which is open @@ -585,20 +608,23 @@ An integer representing the access permission bits. @end table @end deffn -@deffn primitive lstat str +@deffn {Scheme Procedure} lstat str +@deffnx {C Function} scm_lstat (str) Similar to @code{stat}, but does not follow symbolic links, i.e., it will return information about a symbolic link itself, not the file it points to. @var{path} must be a string. @end deffn -@deffn primitive readlink path +@deffn {Scheme Procedure} readlink path +@deffnx {C Function} scm_readlink (path) Return the value of the symbolic link named by @var{path} (a string), i.e., the file that the link points to. @end deffn @findex fchown @findex lchown -@deffn primitive chown object owner group +@deffn {Scheme Procedure} chown object owner group +@deffnx {C Function} scm_chown (object, owner, group) Change the ownership and group of the file referred to by @var{object} to the integer values @var{owner} and @var{group}. @var{object} can be a string containing a file name or, if the platform @@ -614,7 +640,8 @@ as @code{-1}, then that ID is not changed. @end deffn @findex fchmod -@deffn primitive chmod object mode +@deffn {Scheme Procedure} chmod object mode +@deffnx {C Function} scm_chmod (object, mode) Changes the permissions of the file referred to by @var{obj}. @var{obj} can be a string containing a file name or a port or integer file descriptor which is open on a file (in which case @code{fchmod} is used @@ -624,7 +651,8 @@ the new permissions as a decimal number, e.g., @code{(chmod "foo" #o755)}. The return value is unspecified. @end deffn -@deffn primitive utime pathname [actime [modtime]] +@deffn {Scheme Procedure} utime pathname [actime [modtime]] +@deffnx {C Function} scm_utime (pathname, actime, modtime) @code{utime} sets the access and modification times for the file named by @var{path}. If @var{actime} or @var{modtime} is not supplied, then the current time is used. @var{actime} and @@ -638,77 +666,91 @@ modification time to the current time. @end deffn @findex unlink -@deffn primitive delete-file str +@deffn {Scheme Procedure} delete-file str +@deffnx {C Function} scm_delete_file (str) Deletes (or "unlinks") the file specified by @var{path}. @end deffn -@deffn primitive copy-file oldfile newfile +@deffn {Scheme Procedure} copy-file oldfile newfile +@deffnx {C Function} scm_copy_file (oldfile, newfile) Copy the file specified by @var{path-from} to @var{path-to}. The return value is unspecified. @end deffn @findex rename -@deffn primitive rename-file oldname newname +@deffn {Scheme Procedure} rename-file oldname newname +@deffnx {C Function} scm_rename (oldname, newname) Renames the file specified by @var{oldname} to @var{newname}. The return value is unspecified. @end deffn -@deffn primitive link oldpath newpath +@deffn {Scheme Procedure} link oldpath newpath +@deffnx {C Function} scm_link (oldpath, newpath) Creates a new name @var{newpath} in the file system for the file named by @var{oldpath}. If @var{oldpath} is a symbolic link, the link may or may not be followed depending on the system. @end deffn -@deffn primitive symlink oldpath newpath +@deffn {Scheme Procedure} symlink oldpath newpath +@deffnx {C Function} scm_symlink (oldpath, newpath) Create a symbolic link named @var{path-to} with the value (i.e., pointing to) @var{path-from}. The return value is unspecified. @end deffn -@deffn primitive mkdir path [mode] +@deffn {Scheme Procedure} mkdir path [mode] +@deffnx {C Function} scm_mkdir (path, mode) Create a new directory named by @var{path}. If @var{mode} is omitted then the permissions of the directory file are set using the current umask. Otherwise they are set to the decimal value specified with @var{mode}. The return value is unspecified. @end deffn -@deffn primitive rmdir path +@deffn {Scheme Procedure} rmdir path +@deffnx {C Function} scm_rmdir (path) Remove the existing directory named by @var{path}. The directory must be empty for this to succeed. The return value is unspecified. @end deffn -@deffn primitive opendir dirname +@deffn {Scheme Procedure} opendir dirname +@deffnx {C Function} scm_opendir (dirname) Open the directory specified by @var{path} and return a directory stream. @end deffn -@deffn primitive directory-stream? obj +@deffn {Scheme Procedure} directory-stream? obj +@deffnx {C Function} scm_directory_stream_p (obj) Return a boolean indicating whether @var{object} is a directory stream as returned by @code{opendir}. @end deffn -@deffn primitive readdir port +@deffn {Scheme Procedure} readdir port +@deffnx {C Function} scm_readdir (port) Return (as a string) the next directory entry from the directory stream @var{stream}. If there is no remaining entry to be read then the end of file object is returned. @end deffn -@deffn primitive rewinddir port +@deffn {Scheme Procedure} rewinddir port +@deffnx {C Function} scm_rewinddir (port) Reset the directory port @var{stream} so that the next call to @code{readdir} will return the first directory entry. @end deffn -@deffn primitive closedir port +@deffn {Scheme Procedure} closedir port +@deffnx {C Function} scm_closedir (port) Close the directory stream @var{stream}. The return value is unspecified. @end deffn -@deffn primitive sync +@deffn {Scheme Procedure} sync +@deffnx {C Function} scm_sync () Flush the operating system disk buffers. The return value is unspecified. @end deffn -@deffn primitive mknod path type perms dev +@deffn {Scheme Procedure} mknod path type perms dev +@deffnx {C Function} scm_mknod (path, type, perms, dev) Creates a new special file, such as a file corresponding to a device. @var{path} specifies the name of the file. @var{type} should be one of the following symbols: @@ -726,7 +768,8 @@ E.g., The return value is unspecified. @end deffn -@deffn primitive tmpnam +@deffn {Scheme Procedure} tmpnam +@deffnx {C Function} scm_tmpnam () Return a name in the file system that does not match any existing file. However there is no guarantee that another process will not create the file after @code{tmpnam} is called. @@ -734,7 +777,8 @@ Care should be taken if opening the file, e.g., use the @code{O_EXCL} open flag or use @code{mkstemp!} instead. @end deffn -@deffn primitive mkstemp! tmpl +@deffn {Scheme Procedure} mkstemp! tmpl +@deffnx {C Function} scm_mkstemp (tmpl) Create a new unique file in the file system and returns a new buffered port open for reading and writing to the file. @var{tmpl} is a string specifying where the file should be @@ -742,13 +786,15 @@ created: it must end with @code{XXXXXX} and will be changed in place to return the name of the temporary file. @end deffn -@deffn primitive dirname filename +@deffn {Scheme Procedure} dirname filename +@deffnx {C Function} scm_dirname (filename) Return the directory name component of the file name @var{filename}. If @var{filename} does not contain a directory component, @code{.} is returned. @end deffn -@deffn primitive basename filename [suffix] +@deffn {Scheme Procedure} basename filename [suffix] +@deffnx {C Function} scm_basename (filename, suffix) Return the base name of the file name @var{filename}. The base name is the file name without any directory components. If @var{suffix} is privided, and is equal to the end of @@ -783,36 +829,38 @@ The home directory. The login shell. @end table -@deffn procedure getpwuid uid +@deffn {Scheme Procedure} getpwuid uid Look up an integer userid in the user database. @end deffn -@deffn procedure getpwnam name +@deffn {Scheme Procedure} getpwnam name Look up a user name string in the user database. @end deffn -@deffn procedure setpwent +@deffn {Scheme Procedure} setpwent Initializes a stream used by @code{getpwent} to read from the user database. The next use of @code{getpwent} will return the first entry. The return value is unspecified. @end deffn -@deffn procedure getpwent +@deffn {Scheme Procedure} getpwent Return the next entry in the user database, using the stream set by @code{setpwent}. @end deffn -@deffn procedure endpwent +@deffn {Scheme Procedure} endpwent Closes the stream used by @code{getpwent}. The return value is unspecified. @end deffn -@deffn primitive setpw [arg] +@deffn {Scheme Procedure} setpw [arg] +@deffnx {C Function} scm_setpwent (arg) If called with a true argument, initialize or reset the password data stream. Otherwise, close the stream. The @code{setpwent} and @code{endpwent} procedures are implemented on top of this. @end deffn -@deffn primitive getpw [user] +@deffn {Scheme Procedure} getpw [user] +@deffnx {C Function} scm_getpwuid (user) Look up an entry in the user database. @var{obj} can be an integer, a string, or omitted, giving the behaviour of getpwuid, getpwnam or getpwent respectively. @@ -832,37 +880,39 @@ The group id number. A list of userids which have this group as a supplimentary group. @end table -@deffn procedure getgrgid gid +@deffn {Scheme Procedure} getgrgid gid Look up an integer groupid in the group database. @end deffn -@deffn procedure getgrnam name +@deffn {Scheme Procedure} getgrnam name Look up a group name in the group database. @end deffn -@deffn procedure setgrent +@deffn {Scheme Procedure} setgrent Initializes a stream used by @code{getgrent} to read from the group database. The next use of @code{getgrent} will return the first entry. The return value is unspecified. @end deffn -@deffn procedure getgrent +@deffn {Scheme Procedure} getgrent Return the next entry in the group database, using the stream set by @code{setgrent}. @end deffn -@deffn procedure endgrent +@deffn {Scheme Procedure} endgrent Closes the stream used by @code{getgrent}. The return value is unspecified. @end deffn -@deffn primitive setgr [arg] +@deffn {Scheme Procedure} setgr [arg] +@deffnx {C Function} scm_setgrent (arg) If called with a true argument, initialize or reset the group data stream. Otherwise, close the stream. The @code{setgrent} and @code{endgrent} procedures are implemented on top of this. @end deffn -@deffn primitive getgr [name] +@deffn {Scheme Procedure} getgr [name] +@deffnx {C Function} scm_getgrgid (name) Look up an entry in the group database. @var{obj} can be an integer, a string, or omitted, giving the behaviour of getgrgid, getgrnam or getgrent respectively. @@ -871,13 +921,15 @@ or getgrent respectively. In addition to the accessor procedures for the user database, the following shortcut procedures are also available. -@deffn primitive cuserid +@deffn {Scheme Procedure} cuserid +@deffnx {C Function} scm_cuserid () Return a string containing a user name associated with the effective user id of the process. Return @code{#f} if this information cannot be obtained. @end deffn -@deffn primitive getlogin +@deffn {Scheme Procedure} getlogin +@deffnx {C Function} scm_getlogin () Return a string containing the name of the user logged in on the controlling terminal of the process, or @code{#f} if this information cannot be obtained. @@ -887,12 +939,14 @@ information cannot be obtained. @node Time @section Time -@deffn primitive current-time +@deffn {Scheme Procedure} current-time +@deffnx {C Function} scm_current_time () Return the number of seconds since 1970-01-01 00:00:00 UTC, excluding leap seconds. @end deffn -@deffn primitive gettimeofday +@deffn {Scheme Procedure} gettimeofday +@deffnx {C Function} scm_gettimeofday () Return a pair containing the number of seconds and microseconds since 1970-01-01 00:00:00 UTC, excluding leap seconds. Note: whether true microsecond resolution is available depends on the @@ -930,7 +984,8 @@ Time zone offset in seconds west of UTC (-46800 to 43200). Time zone label (a string), not necessarily unique. @end table -@deffn primitive localtime time [zone] +@deffn {Scheme Procedure} localtime time [zone] +@deffnx {C Function} scm_localtime (time, zone) Return an object representing the broken down components of @var{time}, an integer like the one returned by @code{current-time}. The time zone for the calculation is @@ -938,13 +993,15 @@ optionally specified by @var{zone} (a string), otherwise the @code{TZ} environment variable or the system default is used. @end deffn -@deffn primitive gmtime time +@deffn {Scheme Procedure} gmtime time +@deffnx {C Function} scm_gmtime (time) Return an object representing the broken down components of @var{time}, an integer like the one returned by @code{current-time}. The values are calculated for UTC. @end deffn -@deffn primitive mktime sbd_time [zone] +@deffn {Scheme Procedure} mktime sbd_time [zone] +@deffnx {C Function} scm_mktime (sbd_time, zone) @var{bd-time} is an object representing broken down time and @code{zone} is an optional time zone specifier (otherwise the TZ environment variable or the system default is used). @@ -955,14 +1012,16 @@ by @code{current-time}; the cdr is a broken down time object, similar to as @var{bd-time} but with normalized values. @end deffn -@deffn primitive tzset +@deffn {Scheme Procedure} tzset +@deffnx {C Function} scm_tzset () Initialize the timezone from the TZ environment variable or the system default. It's not usually necessary to call this procedure since it's done automatically by other procedures that depend on the timezone. @end deffn -@deffn primitive strftime format stime +@deffn {Scheme Procedure} strftime format stime +@deffnx {C Function} scm_strftime (format, stime) Formats a time specification @var{time} using @var{template}. @var{time} is an object with time components in the form returned by @code{localtime} or @code{gmtime}. @var{template} is a string which can include formatting @@ -972,7 +1031,8 @@ is the formatted string. @xref{Formatting Date and Time, , , libc, The GNU C Library Reference Manual}.) @end deffn -@deffn primitive strptime format string +@deffn {Scheme Procedure} strptime format string +@deffnx {C Function} scm_strptime (format, string) Performs the reverse action to @code{strftime}, parsing @var{string} according to the specification supplied in @var{template}. The interpretation of month and day names is @@ -990,7 +1050,8 @@ The value of this variable is the number of time units per second reported by the following procedures. @end defvar -@deffn primitive times +@deffn {Scheme Procedure} times +@deffnx {C Function} scm_times () Return an object with information about real and processor time. The following procedures accept such an object as an argument and return a selected component: @@ -1014,12 +1075,14 @@ terminated child processes. @end table @end deffn -@deffn primitive get-internal-real-time +@deffn {Scheme Procedure} get-internal-real-time +@deffnx {C Function} scm_get_internal_real_time () Return the number of time units since the interpreter was started. @end deffn -@deffn primitive get-internal-run-time +@deffn {Scheme Procedure} get-internal-run-time +@deffnx {C Function} scm_get_internal_run_time () Return the number of time units of processor time used by the interpreter. Both @emph{system} and @emph{user} time are included but subprocesses are not. @@ -1028,22 +1091,24 @@ included but subprocesses are not. @node Runtime Environment @section Runtime Environment -@deffn primitive program-arguments -@deffnx procedure command-line +@deffn {Scheme Procedure} program-arguments +@deffnx {Scheme Procedure} command-line +@deffnx {C Function} scm_program_arguments () Return the list of command line arguments passed to Guile, as a list of strings. The list includes the invoked program name, which is usually @code{"guile"}, but excludes switches and parameters for command line options like @code{-e} and @code{-l}. @end deffn -@deffn primitive getenv nam +@deffn {Scheme Procedure} getenv nam +@deffnx {C Function} scm_getenv (nam) Looks up the string @var{name} in the current environment. The return value is @code{#f} unless a string of the form @code{NAME=VALUE} is found, in which case the string @code{VALUE} is returned. @end deffn @c begin (scm-doc-string "boot-9.scm" "setenv") -@deffn procedure setenv name value +@deffn {Scheme Procedure} setenv name value Modifies the environment of the current process, which is also the default environment inherited by child processes. @@ -1055,7 +1120,8 @@ to the environment, replacing any existing string with name matching The return value is unspecified. @end deffn -@deffn primitive environ [env] +@deffn {Scheme Procedure} environ [env] +@deffnx {C Function} scm_environ (env) If @var{env} is omitted, return the current environment (in the Unix sense) as a list of strings. Otherwise set the current environment, which is also the default environment for child @@ -1065,7 +1131,8 @@ processes, to the supplied list of strings. Each member of then the return value is unspecified. @end deffn -@deffn primitive putenv str +@deffn {Scheme Procedure} putenv str +@deffnx {C Function} scm_putenv (str) Modifies the environment of the current process, which is also the default environment inherited by child processes. @@ -1084,17 +1151,20 @@ The return value is unspecified. @section Processes @findex cd -@deffn primitive chdir str +@deffn {Scheme Procedure} chdir str +@deffnx {C Function} scm_chdir (str) Change the current working directory to @var{path}. The return value is unspecified. @end deffn @findex pwd -@deffn primitive getcwd +@deffn {Scheme Procedure} getcwd +@deffnx {C Function} scm_getcwd () Return the name of the current working directory. @end deffn -@deffn primitive umask [mode] +@deffn {Scheme Procedure} umask [mode] +@deffnx {C Function} scm_umask (mode) If @var{mode} is omitted, retuns a decimal number representing the current file creation mask. Otherwise the file creation mask is set to @var{mode} and the previous value is returned. @@ -1102,7 +1172,8 @@ file creation mask. Otherwise the file creation mask is set to E.g., @code{(umask #o022)} sets the mask to octal 22, decimal 18. @end deffn -@deffn primitive chroot path +@deffn {Scheme Procedure} chroot path +@deffnx {C Function} scm_chroot (path) Change the root directory to that specified in @var{path}. This directory will be used for path names beginning with @file{/}. The root directory is inherited by all children @@ -1110,55 +1181,65 @@ of the current process. Only the superuser may change the root directory. @end deffn -@deffn primitive getpid +@deffn {Scheme Procedure} getpid +@deffnx {C Function} scm_getpid () Return an integer representing the current process ID. @end deffn -@deffn primitive getgroups +@deffn {Scheme Procedure} getgroups +@deffnx {C Function} scm_getgroups () Return a vector of integers representing the current supplimentary group IDs. @end deffn -@deffn primitive getppid +@deffn {Scheme Procedure} getppid +@deffnx {C Function} scm_getppid () Return an integer representing the process ID of the parent process. @end deffn -@deffn primitive getuid +@deffn {Scheme Procedure} getuid +@deffnx {C Function} scm_getuid () Return an integer representing the current real user ID. @end deffn -@deffn primitive getgid +@deffn {Scheme Procedure} getgid +@deffnx {C Function} scm_getgid () Return an integer representing the current real group ID. @end deffn -@deffn primitive geteuid +@deffn {Scheme Procedure} geteuid +@deffnx {C Function} scm_geteuid () Return an integer representing the current effective user ID. If the system does not support effective IDs, then the real ID is returned. @code{(feature? 'EIDs)} reports whether the system supports effective IDs. @end deffn -@deffn primitive getegid +@deffn {Scheme Procedure} getegid +@deffnx {C Function} scm_getegid () Return an integer representing the current effective group ID. If the system does not support effective IDs, then the real ID is returned. @code{(feature? 'EIDs)} reports whether the system supports effective IDs. @end deffn -@deffn primitive setuid id +@deffn {Scheme Procedure} setuid id +@deffnx {C Function} scm_setuid (id) Sets both the real and effective user IDs to the integer @var{id}, provided the process has appropriate privileges. The return value is unspecified. @end deffn -@deffn primitive setgid id +@deffn {Scheme Procedure} setgid id +@deffnx {C Function} scm_setgid (id) Sets both the real and effective group IDs to the integer @var{id}, provided the process has appropriate privileges. The return value is unspecified. @end deffn -@deffn primitive seteuid id +@deffn {Scheme Procedure} seteuid id +@deffnx {C Function} scm_seteuid (id) Sets the effective user ID to the integer @var{id}, provided the process has appropriate privileges. If effective IDs are not supported, the real ID is set instead -- @code{(feature? 'EIDs)} reports whether the @@ -1166,7 +1247,8 @@ system supports effective IDs. The return value is unspecified. @end deffn -@deffn primitive setegid id +@deffn {Scheme Procedure} setegid id +@deffnx {C Function} scm_setegid (id) Sets the effective group ID to the integer @var{id}, provided the process has appropriate privileges. If effective IDs are not supported, the real ID is set instead -- @code{(feature? 'EIDs)} reports whether the @@ -1174,12 +1256,14 @@ system supports effective IDs. The return value is unspecified. @end deffn -@deffn primitive getpgrp +@deffn {Scheme Procedure} getpgrp +@deffnx {C Function} scm_getpgrp () Return an integer representing the current process group ID. This is the POSIX definition, not BSD. @end deffn -@deffn primitive setpgid pid pgid +@deffn {Scheme Procedure} setpgid pid pgid +@deffnx {C Function} scm_setpgid (pid, pgid) Move the process @var{pid} into the process group @var{pgid}. @var{pid} or @var{pgid} must be integers: they can be zero to indicate the ID of the current process. @@ -1187,14 +1271,16 @@ Fails on systems that do not support job control. The return value is unspecified. @end deffn -@deffn primitive setsid +@deffn {Scheme Procedure} setsid +@deffnx {C Function} scm_setsid () Creates a new session. The current process becomes the session leader and is put in a new process group. The process will be detached from its controlling terminal if it has one. The return value is an integer representing the new process group ID. @end deffn -@deffn primitive waitpid pid [options] +@deffn {Scheme Procedure} waitpid pid [options] +@deffnx {C Function} scm_waitpid (pid, options) This procedure collects status information from a child process which has terminated or (optionally) stopped. Normally it will suspend the calling process until this can be done. If more than one @@ -1242,23 +1328,27 @@ The following three functions can be used to decode the process status code returned by @code{waitpid}. -@deffn primitive status:exit-val status +@deffn {Scheme Procedure} status:exit-val status +@deffnx {C Function} scm_status_exit_val (status) Return the exit status value, as would be set if a process ended normally through a call to @code{exit} or @code{_exit}, if any, otherwise @code{#f}. @end deffn -@deffn primitive status:term-sig status +@deffn {Scheme Procedure} status:term-sig status +@deffnx {C Function} scm_status_term_sig (status) Return the signal number which terminated the process, if any, otherwise @code{#f}. @end deffn -@deffn primitive status:stop-sig status +@deffn {Scheme Procedure} status:stop-sig status +@deffnx {C Function} scm_status_stop_sig (status) Return the signal number which stopped the process, if any, otherwise @code{#f}. @end deffn -@deffn primitive system [cmd] +@deffn {Scheme Procedure} system [cmd] +@deffnx {C Function} scm_system (cmd) Execute @var{cmd} using the operating system's "command processor". Under Unix this is usually the default shell @code{sh}. The value returned is @var{cmd}'s exit status as @@ -1269,13 +1359,15 @@ If @code{system} is called without arguments, return a boolean indicating whether the command processor is available. @end deffn -@deffn primitive primitive-exit [status] +@deffn {Scheme Procedure} primitive-exit [status] +@deffnx {C Function} scm_primitive_exit (status) Terminate the current process without unwinding the Scheme stack. This is would typically be useful after a fork. The exit status is @var{status} if supplied, otherwise zero. @end deffn -@deffn primitive execl filename . args +@deffn {Scheme Procedure} execl filename . args +@deffnx {C Function} scm_execl (filename, args) Executes the file named by @var{path} as a new process image. The remaining arguments are supplied to the process; from a C program they are accessable as the @code{argv} argument to @code{main}. @@ -1289,7 +1381,8 @@ This procedure is currently implemented using the @code{execv} system call, but we call it @code{execl} because of its Scheme calling interface. @end deffn -@deffn primitive execlp filename . args +@deffn {Scheme Procedure} execlp filename . args +@deffnx {C Function} scm_execlp (filename, args) Similar to @code{execl}, however if @var{filename} does not contain a slash then the file to execute will be located by searching the @@ -1299,7 +1392,8 @@ This procedure is currently implemented using the @code{execvp} system call, but we call it @code{execlp} because of its Scheme calling interface. @end deffn -@deffn primitive execle filename env . args +@deffn {Scheme Procedure} execle filename env . args +@deffnx {C Function} scm_execle (filename, env, args) Similar to @code{execl}, but the environment of the new process is specified by @var{env}, which must be a list of strings as returned by the @code{environ} procedure. @@ -1308,7 +1402,8 @@ This procedure is currently implemented using the @code{execve} system call, but we call it @code{execle} because of its Scheme calling interface. @end deffn -@deffn primitive primitive-fork +@deffn {Scheme Procedure} primitive-fork +@deffnx {C Function} scm_fork () Creates a new "child" process by duplicating the current "parent" process. In the child the return value is 0. In the parent the return value is the integer process ID of the child. @@ -1317,13 +1412,15 @@ This procedure has been renamed from @code{fork} to avoid a naming conflict with the scsh fork. @end deffn -@deffn primitive nice incr +@deffn {Scheme Procedure} nice incr +@deffnx {C Function} scm_nice (incr) Increment the priority of the current process by @var{incr}. A higher priority value means that the process runs less often. The return value is unspecified. @end deffn -@deffn primitive setpriority which who prio +@deffn {Scheme Procedure} setpriority which who prio +@deffnx {C Function} scm_setpriority (which, who, prio) Set the scheduling priority of the process, process group or user, as indicated by @var{which} and @var{who}. @var{which} is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP} @@ -1339,7 +1436,8 @@ processes. Only the super-user may lower priorities. The return value is not specified. @end deffn -@deffn primitive getpriority which who +@deffn {Scheme Procedure} getpriority which who +@deffnx {C Function} scm_getpriority (which, who) Return the scheduling priority of the process, process group or user, as indicated by @var{which} and @var{who}. @var{which} is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP} @@ -1358,7 +1456,8 @@ specified processes. Procedures to raise, handle and wait for signals. -@deffn primitive kill pid sig +@deffn {Scheme Procedure} kill pid sig +@deffnx {C Function} scm_kill (pid, sig) Sends a signal to the specified process or group of processes. @var{pid} specifies the processes to which the signal is sent: @@ -1388,12 +1487,14 @@ Interrupt signal. @end defvar @end deffn -@deffn primitive raise sig +@deffn {Scheme Procedure} raise sig +@deffnx {C Function} scm_raise (sig) Sends a specified signal @var{sig} to the current process, where @var{sig} is as described for the kill procedure. @end deffn -@deffn primitive sigaction signum [handler [flags]] +@deffn {Scheme Procedure} sigaction signum [handler [flags]] +@deffnx {C Function} scm_sigaction (signum, handler, flags) Install or report the signal handler for a specified signal. @var{signum} is the signal number, which can be specified using the value @@ -1422,12 +1523,14 @@ provide solutions to the problem of consistent access to data structures. @end deffn -@deffn primitive restore-signals +@deffn {Scheme Procedure} restore-signals +@deffnx {C Function} scm_restore_signals () Return all signal handlers to the values they had before any call to @code{sigaction} was made. The return value is unspecified. @end deffn -@deffn primitive alarm i +@deffn {Scheme Procedure} alarm i +@deffnx {C Function} scm_alarm (i) Set a timer to raise a @code{SIGALRM} signal after the specified number of seconds (an integer). It's advisable to install a signal handler for @@ -1439,24 +1542,28 @@ if any. The new value replaces the previous alarm. If there was no previous alarm, the return value is zero. @end deffn -@deffn primitive pause +@deffn {Scheme Procedure} pause +@deffnx {C Function} scm_pause () Pause the current process (thread?) until a signal arrives whose action is to either terminate the current process or invoke a handler procedure. The return value is unspecified. @end deffn -@deffn primitive sleep i +@deffn {Scheme Procedure} sleep i +@deffnx {C Function} scm_sleep (i) Wait for the given number of seconds (an integer) or until a signal arrives. The return value is zero if the time elapses or the number of seconds remaining otherwise. @end deffn -@deffn primitive usleep i +@deffn {Scheme Procedure} usleep i +@deffnx {C Function} scm_usleep (i) Sleep for I microseconds. @code{usleep} is not available on all platforms. @end deffn -@deffn primitive setitimer which_timer interval_seconds interval_microseconds value_seconds value_microseconds +@deffn {Scheme Procedure} setitimer which_timer interval_seconds interval_microseconds value_seconds value_microseconds +@deffnx {C Function} scm_setitimer (which_timer, interval_seconds, interval_microseconds, value_seconds, value_microseconds) Set the timer specified by @var{which_timer} according to the given @var{interval_seconds}, @var{interval_microseconds}, @var{value_seconds}, and @var{value_microseconds} values. @@ -1474,7 +1581,8 @@ microseconds of the timer @code{it_interval}, and the second pair is the seconds and microseconds of the timer @code{it_value}. @end deffn -@deffn primitive getitimer which_timer +@deffn {Scheme Procedure} getitimer which_timer +@deffnx {C Function} scm_getitimer (which_timer) Return information about the timer specified by @var{which_timer} Errors are handled as described in the guile info pages under ``POSIX Interface Conventions''. @@ -1492,22 +1600,26 @@ the seconds and microseconds of the timer @code{it_value}. @node Terminals and Ptys @section Terminals and Ptys -@deffn primitive isatty? port +@deffn {Scheme Procedure} isatty? port +@deffnx {C Function} scm_isatty_p (port) Return @code{#t} if @var{port} is using a serial non--file device, otherwise @code{#f}. @end deffn -@deffn primitive ttyname port +@deffn {Scheme Procedure} ttyname port +@deffnx {C Function} scm_ttyname (port) Return a string with the name of the serial terminal device underlying @var{port}. @end deffn -@deffn primitive ctermid +@deffn {Scheme Procedure} ctermid +@deffnx {C Function} scm_ctermid () Return a string containing the file name of the controlling terminal for the current process. @end deffn -@deffn primitive tcgetpgrp port +@deffn {Scheme Procedure} tcgetpgrp port +@deffnx {C Function} scm_tcgetpgrp (port) Return the process group ID of the foreground process group associated with the terminal open on the file descriptor underlying @var{port}. @@ -1520,7 +1632,8 @@ terminated, and no other job has yet been moved into the foreground. @end deffn -@deffn primitive tcsetpgrp port pgid +@deffn {Scheme Procedure} tcsetpgrp port pgid +@deffnx {C Function} scm_tcsetpgrp (port, pgid) Set the foreground process group ID for the terminal used by the file descriptor underlying @var{port} to the integer @var{pgid}. The calling process @@ -1540,23 +1653,23 @@ module: @end smalllisp @findex popen -@deffn procedure open-pipe command modes +@deffn {Scheme Procedure} open-pipe command modes Executes the shell command @var{command} (a string) in a subprocess. A pipe to the process is created and returned. @var{modes} specifies whether an input or output pipe to the process is created: it should be the value of @code{OPEN_READ} or @code{OPEN_WRITE}. @end deffn -@deffn procedure open-input-pipe command +@deffn {Scheme Procedure} open-input-pipe command Equivalent to @code{open-pipe} with mode @code{OPEN_READ}. @end deffn -@deffn procedure open-output-pipe command +@deffn {Scheme Procedure} open-output-pipe command Equivalent to @code{open-pipe} with mode @code{OPEN_WRITE}. @end deffn @findex pclose -@deffn procedure close-pipe port +@deffn {Scheme Procedure} close-pipe port Closes the pipe created by @code{open-pipe}, then waits for the process to terminate and returns its status value, @xref{Processes, waitpid}, for information on how to interpret this value. @@ -1582,7 +1695,8 @@ between numeric and string formats. @subsubsection IPv4 Address Conversion -@deffn primitive inet-aton address +@deffn {Scheme Procedure} inet-aton address +@deffnx {C Function} scm_inet_aton (address) Convert an IPv4 Internet address from printable string (dotted decimal notation) to an integer. E.g., @@ -1591,7 +1705,8 @@ Convert an IPv4 Internet address from printable string @end lisp @end deffn -@deffn primitive inet-ntoa inetid +@deffn {Scheme Procedure} inet-ntoa inetid +@deffnx {C Function} scm_inet_ntoa (inetid) Convert an IPv4 Internet address to a printable (dotted decimal notation) string. E.g., @@ -1600,7 +1715,8 @@ Convert an IPv4 Internet address to a printable @end lisp @end deffn -@deffn primitive inet-netof address +@deffn {Scheme Procedure} inet-netof address +@deffnx {C Function} scm_inet_netof (address) Return the network number part of the given IPv4 Internet address. E.g., @@ -1609,7 +1725,8 @@ Internet address. E.g., @end lisp @end deffn -@deffn primitive inet-lnaof address +@deffn {Scheme Procedure} inet-lnaof address +@deffnx {C Function} scm_lnaof (address) Return the local-address-with-network part of the given IPv4 Internet address, using the obsolete class A/B/C system. E.g., @@ -1619,7 +1736,8 @@ E.g., @end lisp @end deffn -@deffn primitive inet-makeaddr net lna +@deffn {Scheme Procedure} inet-makeaddr net lna +@deffnx {C Function} scm_inet_makeaddr (net, lna) Make an IPv4 Internet address by combining the network number @var{net} with the local-address-within-network number @var{lna}. E.g., @@ -1631,7 +1749,8 @@ Make an IPv4 Internet address by combining the network number @subsubsection IPv6 Address Conversion -@deffn primitive inet-ntop family address +@deffn {Scheme Procedure} inet-ntop family address +@deffnx {C Function} scm_inet_ntop (family, address) Convert a network address into a printable string. Note that unlike the C version of this function, the input is an integer with normal host byte ordering. @@ -1644,7 +1763,8 @@ ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff @end lisp @end deffn -@deffn primitive inet-pton family address +@deffn {Scheme Procedure} inet-pton family address +@deffnx {C Function} scm_inet_pton (family, address) Convert a string containing a printable network address to an integer address. Note that unlike the C version of this function, @@ -1674,28 +1794,29 @@ identity inside software. The following functions accept a host object and return a selected component: -@deffn procedure hostent:name host +@deffn {Scheme Procedure} hostent:name host The "official" hostname for @var{host}. @end deffn -@deffn procedure hostent:aliases host +@deffn {Scheme Procedure} hostent:aliases host A list of aliases for @var{host}. @end deffn -@deffn procedure hostent:addrtype host +@deffn {Scheme Procedure} hostent:addrtype host The host address type. For hosts with Internet addresses, this will return @code{AF_INET}. @end deffn -@deffn procedure hostent:length host +@deffn {Scheme Procedure} hostent:length host The length of each address for @var{host}, in bytes. @end deffn -@deffn procedure hostent:addr-list host +@deffn {Scheme Procedure} hostent:addr-list host The list of network addresses associated with @var{host}. @end deffn The following procedures are used to search the host database: -@deffn primitive gethost [host] -@deffnx procedure gethostbyname hostname -@deffnx procedure gethostbyaddr address +@deffn {Scheme Procedure} gethost [host] +@deffnx {Scheme Procedure} gethostbyname hostname +@deffnx {Scheme Procedure} gethostbyaddr address +@deffnx {C Function} scm_gethost (host) Look up a host by name or address, returning a host object. The @code{gethost} procedure will accept either a string name or an integer address; if given no arguments, it behaves like @code{gethostent} (see @@ -1710,7 +1831,7 @@ Unusual conditions may result in errors thrown to the The following procedures may be used to step through the host database from beginning to end. -@deffn procedure sethostent [stayopen] +@deffn {Scheme Procedure} sethostent [stayopen] Initialize an internal stream from which host objects may be read. This procedure must be called before any calls to @code{gethostent}, and may also be called afterward to reset the host entry stream. If @@ -1719,17 +1840,18 @@ closed by subsequent @code{gethostbyname} or @code{gethostbyaddr} calls, possibly giving an efficiency gain. @end deffn -@deffn procedure gethostent +@deffn {Scheme Procedure} gethostent Return the next host object from the host database, or @code{#f} if there are no more hosts to be found (or an error has been encountered). This procedure may not be used before @code{sethostent} has been called. @end deffn -@deffn procedure endhostent +@deffn {Scheme Procedure} endhostent Close the stream used by @code{gethostent}. The return value is unspecified. @end deffn -@deffn primitive sethost [stayopen] +@deffn {Scheme Procedure} sethost [stayopen] +@deffnx {C Function} scm_sethost (stayopen) If @var{stayopen} is omitted, this is equivalent to @code{endhostent}. Otherwise it is equivalent to @code{sethostent stayopen}. @end deffn @@ -1738,25 +1860,26 @@ Otherwise it is equivalent to @code{sethostent stayopen}. The following functions accept an object representing a network and return a selected component: -@deffn procedure netent:name net +@deffn {Scheme Procedure} netent:name net The "official" network name. @end deffn -@deffn procedure netent:aliases net +@deffn {Scheme Procedure} netent:aliases net A list of aliases for the network. @end deffn -@deffn procedure netent:addrtype net +@deffn {Scheme Procedure} netent:addrtype net The type of the network number. Currently, this returns only @code{AF_INET}. @end deffn -@deffn procedure netent:net net +@deffn {Scheme Procedure} netent:net net The network number. @end deffn The following procedures are used to search the network database: -@deffn primitive getnet [net] -@deffnx procedure getnetbyname net-name -@deffnx procedure getnetbyaddr net-number +@deffn {Scheme Procedure} getnet [net] +@deffnx {Scheme Procedure} getnetbyname net-name +@deffnx {Scheme Procedure} getnetbyaddr net-number +@deffnx {C Function} scm_getnet (net) Look up a network by name or net number in the network database. The @var{net-name} argument must be a string, and the @var{net-number} argument must be an integer. @code{getnet} will accept either type of @@ -1767,7 +1890,7 @@ given. The following procedures may be used to step through the network database from beginning to end. -@deffn procedure setnetent [stayopen] +@deffn {Scheme Procedure} setnetent [stayopen] Initialize an internal stream from which network objects may be read. This procedure must be called before any calls to @code{getnetent}, and may also be called afterward to reset the net entry stream. If @@ -1776,15 +1899,16 @@ closed by subsequent @code{getnetbyname} or @code{getnetbyaddr} calls, possibly giving an efficiency gain. @end deffn -@deffn procedure getnetent +@deffn {Scheme Procedure} getnetent Return the next entry from the network database. @end deffn -@deffn procedure endnetent +@deffn {Scheme Procedure} endnetent Close the stream used by @code{getnetent}. The return value is unspecified. @end deffn -@deffn primitive setnet [stayopen] +@deffn {Scheme Procedure} setnet [stayopen] +@deffnx {C Function} scm_setnet (stayopen) If @var{stayopen} is omitted, this is equivalent to @code{endnetent}. Otherwise it is equivalent to @code{setnetent stayopen}. @end deffn @@ -1794,21 +1918,22 @@ Otherwise it is equivalent to @code{setnetent stayopen}. The following functions accept an object representing a protocol and return a selected component: -@deffn procedure protoent:name protocol +@deffn {Scheme Procedure} protoent:name protocol The "official" protocol name. @end deffn -@deffn procedure protoent:aliases protocol +@deffn {Scheme Procedure} protoent:aliases protocol A list of aliases for the protocol. @end deffn -@deffn procedure protoent:proto protocol +@deffn {Scheme Procedure} protoent:proto protocol The protocol number. @end deffn The following procedures are used to search the protocol database: -@deffn primitive getproto [protocol] -@deffnx procedure getprotobyname name -@deffnx procedure getprotobynumber number +@deffn {Scheme Procedure} getproto [protocol] +@deffnx {Scheme Procedure} getprotobyname name +@deffnx {Scheme Procedure} getprotobynumber number +@deffnx {C Function} scm_getproto (protocol) Look up a network protocol by name or by number. @code{getprotobyname} takes a string argument, and @code{getprotobynumber} takes an integer argument. @code{getproto} will accept either type, behaving like @@ -1818,7 +1943,7 @@ argument. @code{getproto} will accept either type, behaving like The following procedures may be used to step through the protocol database from beginning to end. -@deffn procedure setprotoent [stayopen] +@deffn {Scheme Procedure} setprotoent [stayopen] Initialize an internal stream from which protocol objects may be read. This procedure must be called before any calls to @code{getprotoent}, and may also be called afterward to reset the protocol entry stream. If @@ -1827,15 +1952,16 @@ closed by subsequent @code{getprotobyname} or @code{getprotobynumber} calls, possibly giving an efficiency gain. @end deffn -@deffn procedure getprotoent +@deffn {Scheme Procedure} getprotoent Return the next entry from the protocol database. @end deffn -@deffn procedure endprotoent +@deffn {Scheme Procedure} endprotoent Close the stream used by @code{getprotoent}. The return value is unspecified. @end deffn -@deffn primitive setproto [stayopen] +@deffn {Scheme Procedure} setproto [stayopen] +@deffnx {C Function} scm_setproto (stayopen) If @var{stayopen} is omitted, this is equivalent to @code{endprotoent}. Otherwise it is equivalent to @code{setprotoent stayopen}. @end deffn @@ -1845,25 +1971,26 @@ Otherwise it is equivalent to @code{setprotoent stayopen}. The following functions accept an object representing a service and return a selected component: -@deffn procedure servent:name serv +@deffn {Scheme Procedure} servent:name serv The "official" name of the network service. @end deffn -@deffn procedure servent:aliases serv +@deffn {Scheme Procedure} servent:aliases serv A list of aliases for the network service. @end deffn -@deffn procedure servent:port serv +@deffn {Scheme Procedure} servent:port serv The Internet port used by the service. @end deffn -@deffn procedure servent:proto serv +@deffn {Scheme Procedure} servent:proto serv The protocol used by the service. A service may be listed many times in the database under different protocol names. @end deffn The following procedures are used to search the service database: -@deffn primitive getserv [name [protocol]] -@deffnx procedure getservbyname name protocol -@deffnx procedure getservbyport port protocol +@deffn {Scheme Procedure} getserv [name [protocol]] +@deffnx {Scheme Procedure} getservbyname name protocol +@deffnx {Scheme Procedure} getservbyport port protocol +@deffnx {C Function} scm_getserv (name, protocol) Look up a network service by name or by service number, and return a network service object. The @var{protocol} argument specifies the name of the desired protocol; if the protocol found in the network service @@ -1877,7 +2004,7 @@ as its first argument; if given no arguments, it behaves like The following procedures may be used to step through the service database from beginning to end. -@deffn procedure setservent [stayopen] +@deffn {Scheme Procedure} setservent [stayopen] Initialize an internal stream from which service objects may be read. This procedure must be called before any calls to @code{getservent}, and may also be called afterward to reset the service entry stream. If @@ -1886,15 +2013,16 @@ closed by subsequent @code{getservbyname} or @code{getservbyport} calls, possibly giving an efficiency gain. @end deffn -@deffn procedure getservent +@deffn {Scheme Procedure} getservent Return the next entry from the services database. @end deffn -@deffn procedure endservent +@deffn {Scheme Procedure} endservent Close the stream used by @code{getservent}. The return value is unspecified. @end deffn -@deffn primitive setserv [stayopen] +@deffn {Scheme Procedure} setserv [stayopen] +@deffnx {C Function} scm_setserv (stayopen) If @var{stayopen} is omitted, this is equivalent to @code{endservent}. Otherwise it is equivalent to @code{setservent stayopen}. @end deffn @@ -1912,7 +2040,8 @@ are always held in host order at the Scheme level. The procedures in this section automatically convert between host and network order when required. The arguments and return values are thus in host order. -@deffn primitive socket family style proto +@deffn {Scheme Procedure} socket family style proto +@deffnx {C Function} scm_socket (family, style, proto) Return a new socket port of the type specified by @var{family}, @var{style} and @var{proto}. All three parameters are integers. Supported values for @var{family} are @@ -1928,7 +2057,8 @@ A single socket port cannot by used for communication until it has been connected to another socket. @end deffn -@deffn primitive socketpair family style proto +@deffn {Scheme Procedure} socketpair family style proto +@deffnx {C Function} scm_socketpair (family, style, proto) Return a pair of connected (but unnamed) socket ports of the type specified by @var{family}, @var{style} and @var{proto}. Many systems support only socket pairs of the @code{AF_UNIX} @@ -1936,7 +2066,8 @@ family. Zero is likely to be the only meaningful value for @var{proto}. @end deffn -@deffn primitive getsockopt sock level optname +@deffn {Scheme Procedure} getsockopt sock level optname +@deffnx {C Function} scm_getsockopt (sock, level, optname) Return the value of a particular socket option for the socket port @var{sock}. @var{level} is an integer code for type of option being requested, e.g., @code{SOL_SOCKET} for @@ -1948,7 +2079,8 @@ The returned value is typically an integer but @code{SO_LINGER} returns a pair of integers. @end deffn -@deffn primitive setsockopt sock level optname value +@deffn {Scheme Procedure} setsockopt sock level optname value +@deffnx {C Function} scm_setsockopt (sock, level, optname, value) Set the value of a particular socket option for the socket port @var{sock}. @var{level} is an integer code for type of option being set, e.g., @code{SOL_SOCKET} for socket-level options. @@ -1962,7 +2094,8 @@ be a pair. The return value is unspecified. @end deffn -@deffn primitive shutdown sock how +@deffn {Scheme Procedure} shutdown sock how +@deffnx {C Function} scm_shutdown (sock, how) Sockets can be closed simply by using @code{close-port}. The @code{shutdown} procedure allows reception or tranmission on a connection to be shut down individually, according to the parameter @@ -1982,7 +2115,8 @@ Stop both reception and transmission. The return value is unspecified. @end deffn -@deffn primitive connect sock fam address . args +@deffn {Scheme Procedure} connect sock fam address . args +@deffnx {C Function} scm_connect (sock, fam, address, args) Initiate a connection from a socket using a specified address family to the address specified by @var{address} and possibly @var{args}. @@ -2006,7 +2140,8 @@ where flowinfo and scope_id default to zero. The return value is unspecified. @end deffn -@deffn primitive bind sock fam address . args +@deffn {Scheme Procedure} bind sock fam address . args +@deffnx {C Function} scm_bind (sock, fam, address, args) Assign an address to the socket port @var{sock}. Generally this only needs to be done for server sockets, so they know where to look for incoming connections. A socket @@ -2052,7 +2187,8 @@ where flowinfo and scope_id default to zero. The return value is unspecified. @end deffn -@deffn primitive listen sock backlog +@deffn {Scheme Procedure} listen sock backlog +@deffnx {C Function} scm_listen (sock, backlog) Enable @var{sock} to accept connection requests. @var{backlog} is an integer specifying the maximum length of the queue for pending connections. @@ -2063,7 +2199,8 @@ the queue. The return value is unspecified. @end deffn -@deffn primitive accept sock +@deffn {Scheme Procedure} accept sock +@deffnx {C Function} scm_accept (sock) Accept a connection on a bound, listening socket. If there are no pending connections in the queue, wait until @@ -2098,20 +2235,23 @@ If the socket family is @code{AF_INET}, returns the Internet port number. @end table -@deffn primitive getsockname sock +@deffn {Scheme Procedure} getsockname sock +@deffnx {C Function} scm_getsockname (sock) Return the address of @var{sock}, in the same form as the object returned by @code{accept}. On many systems the address of a socket in the @code{AF_FILE} namespace cannot be read. @end deffn -@deffn primitive getpeername sock +@deffn {Scheme Procedure} getpeername sock +@deffnx {C Function} scm_getpeername (sock) Return the address that @var{sock} is connected to, in the same form as the object returned by @code{accept}. On many systems the address of a socket in the @code{AF_FILE} namespace cannot be read. @end deffn -@deffn primitive recv! sock buf [flags] +@deffn {Scheme Procedure} recv! sock buf [flags] +@deffnx {C Function} scm_recv (sock, buf, flags) Receive data from a socket port. @var{sock} must already be bound to the address from which data is to be received. @@ -2134,7 +2274,8 @@ descriptor: any unread buffered port data is ignored. @end deffn -@deffn primitive send sock message [flags] +@deffn {Scheme Procedure} send sock message [flags] +@deffnx {C Function} scm_send (sock, message, flags) Transmit the string @var{message} on a socket port @var{sock}. @var{sock} must already be bound to a destination address. The value returned is the number of bytes transmitted -- @@ -2150,7 +2291,8 @@ file descriptor: any unflushed buffered port data is ignored. @end deffn -@deffn primitive recvfrom! sock str [flags [start [end]]] +@deffn {Scheme Procedure} recvfrom! sock str [flags [start [end]]] +@deffnx {C Function} scm_recvfrom (sock, str, flags, start, end) Return data from the socket port @var{sock} and also information about where the data was received from. @var{sock} must already be bound to the address from which @@ -2176,7 +2318,8 @@ Note that the data is read directly from the socket file descriptor: any unread buffered port data is ignored. @end deffn -@deffn primitive sendto sock message fam address . args_and_flags +@deffn {Scheme Procedure} sendto sock message fam address . args_and_flags +@deffnx {C Function} scm_sendto (sock, message, fam, address, args_and_flags) Transmit the string @var{message} on the socket port @var{sock}. The destination address is specified using the @var{fam}, @@ -2202,25 +2345,29 @@ between "host" and "network" order. Although the procedures above do this automatically for addresses, the conversion will still need to be done when sending or receiving encoded integer data from the network. -@deffn primitive htons value +@deffn {Scheme Procedure} htons value +@deffnx {C Function} scm_htons (value) Convert a 16 bit quantity from host to network byte ordering. @var{value} is packed into 2 bytes, which are then converted and returned as a new integer. @end deffn -@deffn primitive ntohs value +@deffn {Scheme Procedure} ntohs value +@deffnx {C Function} scm_ntohs (value) Convert a 16 bit quantity from network to host byte ordering. @var{value} is packed into 2 bytes, which are then converted and returned as a new integer. @end deffn -@deffn primitive htonl value +@deffn {Scheme Procedure} htonl value +@deffnx {C Function} scm_htonl (value) Convert a 32 bit quantity from host to network byte ordering. @var{value} is packed into 4 bytes, which are then converted and returned as a new integer. @end deffn -@deffn primitive ntohl value +@deffn {Scheme Procedure} ntohl value +@deffnx {C Function} scm_ntohl (value) Convert a 32 bit quantity from network to host byte ordering. @var{value} is packed into 4 bytes, which are then converted and returned as a new integer. @@ -2248,7 +2395,8 @@ These procedures are inconvenient to use at present, but consider: This section lists the various procedures Guile provides for accessing information about the system it runs on. -@deffn primitive uname +@deffn {Scheme Procedure} uname +@deffnx {C Function} scm_uname () Return an object with some information about the computer system the program is running on. @end deffn @@ -2269,18 +2417,20 @@ The current version level within the release of the operating system. A description of the hardware. @end table -@deffn primitive gethostname +@deffn {Scheme Procedure} gethostname +@deffnx {C Function} scm_gethostname () Return the host name of the current processor. @end deffn -@deffn primitive sethostname name +@deffn {Scheme Procedure} sethostname name +@deffnx {C Function} scm_sethostname (name) Set the host name of the current processor to @var{name}. May only be used by the superuser. The return value is not specified. @end deffn @c FIXME::martin: Not in libguile! -@deffn primitive software-type +@deffn {Scheme Procedure} software-type Return a symbol describing the current platform's operating system. This may be one of AIX, VMS, UNIX, COHERENT, WINDOWS, MS-DOS, OS/2, THINKC, AMIGA, ATARIST, MACH, or ACORN. @@ -2296,7 +2446,8 @@ no other easy or unambiguous way of detecting such features. @node Locales @section Locales -@deffn primitive setlocale category [locale] +@deffn {Scheme Procedure} setlocale category [locale] +@deffnx {C Function} scm_setlocale (category, locale) If @var{locale} is omitted, return the current value of the specified locale category as a system-dependent string. @var{category} should be specified using the values @@ -2317,7 +2468,8 @@ common system library functions of the same name. They are just as good (or bad) as the underlying functions, so you should refer to your system documentation before using them. -@deffn primitive crypt key salt +@deffn {Scheme Procedure} crypt key salt +@deffnx {C Function} scm_crypt (key, salt) Encrypt @var{key} using @var{salt} as the salt value to the crypt(3) library call. @end deffn @@ -2326,7 +2478,8 @@ crypt(3) library call. in compination with @code{crypt}, that is why it appears in this section. -@deffn primitive getpass prompt +@deffn {Scheme Procedure} getpass prompt +@deffnx {C Function} scm_getpass (prompt) Display @var{prompt} to the standard error output and read a password from @file{/dev/tty}. If this file is not accessible, it reads from standard input. The password may be diff --git a/doc/ref/scheme-binding.texi b/doc/ref/scheme-binding.texi index 5e476141e..38f9bae08 100644 --- a/doc/ref/scheme-binding.texi +++ b/doc/ref/scheme-binding.texi @@ -232,7 +232,8 @@ bound in expression, you can use the @code{bound?} macro from the module @code{(ice-9 optargs)}, documented in @ref{Optional Arguments}. @c NJFIXME explain [env] -@deffn primitive defined? sym [env] +@deffn {Scheme Procedure} defined? sym [env] +@deffnx {C Function} scm_definedp (sym, env) Return @code{#t} if @var{sym} is defined in the lexical environment @var{env}. When @var{env} is not specified, look in the top-level environment as defined by the current module. @end deffn diff --git a/doc/ref/scheme-control.texi b/doc/ref/scheme-control.texi index d7b95151b..c53d9fd5e 100644 --- a/doc/ref/scheme-control.texi +++ b/doc/ref/scheme-control.texi @@ -273,7 +273,7 @@ for escape procedures and your program is running too slow, you might want to use exceptions (@pxref{Exceptions}) instead. @rnindex call-with-current-continuation -@deffn primitive call-with-current-continuation proc +@deffn {Scheme Procedure} call-with-current-continuation proc Capture the current continuation and call @var{proc} with the captured continuation as the single argument. This continuation can then be called with arbitrarily many arguments. Such a call will work like a @@ -325,7 +325,8 @@ multiple values with a procedure which accepts these values as parameters. @rnindex values -@deffn primitive values expr @dots{} +@deffn {Scheme Procedure} values . args +@deffnx {C Function} scm_values (args) Delivers all of its arguments to its continuation. Except for continuations created by the @code{call-with-values} procedure, all continuations take exactly one value. The effect of @@ -334,7 +335,7 @@ were not created by @code{call-with-values} is unspecified. @end deffn @rnindex call-with-values -@deffn primitive call-with-values producer consumer +@deffn {Scheme Procedure} call-with-values producer consumer Calls its @var{producer} argument with no values and a continuation that, when passed some values, calls the @var{consumer} procedure with those values as arguments. The @@ -490,7 +491,8 @@ procedure must be designed to accept a number of arguments that corresponds to the number of arguments in all @code{throw} expressions that can be caught by this @code{catch}. -@deffn primitive catch key thunk handler +@deffn {Scheme Procedure} catch key thunk handler +@deffnx {C Function} scm_catch (key, thunk, handler) Invoke @var{thunk} in the dynamic context of @var{handler} for exceptions matching @var{key}. If thunk throws to the symbol @var{key}, then @var{handler} is invoked this way: @@ -545,7 +547,8 @@ depends on the exception type. The documentation for each possible type of exception should specify the additional arguments that are expected for that kind of exception. -@deffn primitive throw key . args +@deffn {Scheme Procedure} throw key . args +@deffnx {C Function} scm_throw (key, args) Invoke the catch form matching @var{key}, passing @var{args} to the @var{handler}. @@ -607,7 +610,8 @@ one important respect: the handler procedure is executed without unwinding the call stack from the context of the @code{throw} expression that caused the handler to be invoked. -@deffn primitive lazy-catch key thunk handler +@deffn {Scheme Procedure} lazy-catch key thunk handler +@deffnx {C Function} scm_lazy_catch (key, thunk, handler) This behaves exactly like @code{catch}, except that it does not unwind the stack before invoking @var{handler}. The @var{handler} procedure is not allowed to return: @@ -728,12 +732,13 @@ Guile provides a set of convenience procedures for signaling error conditions that are implemented on top of the exception primitives just described. -@deffn procedure error msg args @dots{} +@deffn {Scheme Procedure} error msg args @dots{} Raise an error with key @code{misc-error} and a message constructed by displaying @var{msg} and writing @var{args}. @end deffn -@deffn primitive scm-error key subr message args data +@deffn {Scheme Procedure} scm-error key subr message args data +@deffnx {C Function} scm_error_scm (key, subr, message, args, data) Raise an error with key @var{key}. @var{subr} can be a string naming the procedure associated with the error, or @code{#f}. @var{message} is the error message string, possibly containing @@ -749,7 +754,8 @@ should be a list containing the Unix signal number; otherwise it will usually be @code{#f}. @end deffn -@deffn primitive strerror err +@deffn {Scheme Procedure} strerror err +@deffnx {C Function} scm_strerror (err) Return the Unix error message corresponding to @var{err}, which must be an integer value. @end deffn @@ -769,7 +775,8 @@ if an exception occurs then @code{#f} is returned instead. be reviewed] @rnindex dynamic-wind -@deffn primitive dynamic-wind in_guard thunk out_guard +@deffn {Scheme Procedure} dynamic-wind in_guard thunk out_guard +@deffnx {C Function} scm_dynamic_wind (in_guard, thunk, out_guard) All three arguments must be 0-argument procedures. @var{in_guard} is called, then @var{thunk}, then @var{out_guard}. @@ -861,12 +868,12 @@ be @code{#f} if no additional objects are required. In addition to @code{catch} and @code{throw}, the following Scheme facilities are available: -@deffn primitive scm-error key subr message args rest +@deffn {Scheme Procedure} scm-error key subr message args rest Throw an error, with arguments as described above. @end deffn -@deffn procedure error msg arg @dots{} +@deffn {Scheme Procedure} error msg arg @dots{} Throw an error using the key @code{'misc-error}. The error message is created by displaying @var{msg} and writing the @var{args}. @end deffn diff --git a/doc/ref/scheme-data.texi b/doc/ref/scheme-data.texi index 1583f413f..e8ffd3a81 100755 --- a/doc/ref/scheme-data.texi +++ b/doc/ref/scheme-data.texi @@ -123,7 +123,8 @@ number 0 (like in C and C++), and not the same as the ``empty list'' The @code{not} procedure returns the boolean inverse of its argument: @rnindex not -@deffn primitive not x +@deffn {Scheme Procedure} not x +@deffnx {C Function} scm_not (x) Return @code{#t} iff @var{x} is @code{#f}, else return @code{#f}. @end deffn @@ -131,7 +132,8 @@ The @code{boolean?} procedure is a predicate that returns @code{#t} if its argument is one of the boolean values, otherwise @code{#f}. @rnindex boolean? -@deffn primitive boolean? obj +@deffn {Scheme Procedure} boolean? obj +@deffnx {C Function} scm_boolean_p (obj) Return @code{#t} iff @var{obj} is either @code{#t} or @code{#f}. @end deffn @@ -205,8 +207,10 @@ converted by Guile to the corresponding real number. The @code{number?} predicate may be applied to any Scheme value to discover whether the value is any of the supported numerical types. -@deffn primitive number? obj +@deffn {Scheme Procedure} number? obj +@deffnx {C Function} scm_number_p (obj) Return @code{#t} if @var{obj} is any kind of number, @code{#f} else. +@findex number? @end deffn For example: @@ -275,7 +279,8 @@ completely invisible to the Scheme level programmer. @c REFFIXME Maybe point here to discussion of handling immediates/bignums @c on the C level, where the conversion is not so automatic - NJ -@deffn primitive integer? x +@deffn {Scheme Procedure} integer? x +@deffnx {C Function} scm_integer_p (x) Return @code{#t} if @var{x} is an integer number, @code{#f} else. @lisp @@ -338,14 +343,17 @@ rational numbers and real irrational numbers such as square roots, and in such a way that the new kinds of number integrate seamlessly with those that are already implemented. -@deffn primitive real? obj +@deffn {Scheme Procedure} real? obj +@deffnx {C Function} scm_real_p (obj) Return @code{#t} if @var{obj} is a real number, @code{#f} else. Note that the sets of integer and rational values form subsets of the set of real numbers, so the predicate will also be fulfilled if @var{obj} is an integer number or a rational number. +@findex real? @end deffn -@deffn primitive rational? x +@deffn {Scheme Procedure} rational? x +@deffnx {C Function} scm_real_p (x) Return @code{#t} if @var{x} is a rational number, @code{#f} else. Note that the set of integer values forms a subset of the set of rational numbers, i. e. the predicate will also be @@ -384,7 +392,8 @@ Guile represents a complex number as a pair of numbers both of which are real, so the real and imaginary parts of a complex number have the same properties of inexactness and limited precision as single real numbers. -@deffn primitive complex? x +@deffn {Scheme Procedure} complex? x +@deffnx {C Function} scm_number_p (x) Return @code{#t} if @var{x} is a complex number, @code{#f} else. Note that the sets of real, rational and integer values form subsets of the set of complex numbers, i. e. the @@ -411,22 +420,25 @@ available, has no fractional part, and is printed as @code{5.0}. Guile will only convert the latter value to the former when forced to do so by an invocation of the @code{inexact->exact} procedure. -@deffn primitive exact? x +@deffn {Scheme Procedure} exact? x +@deffnx {C Function} scm_exact_p (x) Return @code{#t} if @var{x} is an exact number, @code{#f} otherwise. @end deffn -@deffn primitive inexact? x +@deffn {Scheme Procedure} inexact? x +@deffnx {C Function} scm_inexact_p (x) Return @code{#t} if @var{x} is an inexact number, @code{#f} else. @end deffn -@deffn primitive inexact->exact z +@deffn {Scheme Procedure} inexact->exact z +@deffnx {C Function} scm_inexact_to_exact (z) Return an exact number that is numerically closest to @var{z}. @end deffn @c begin (texi-doc-string "guile" "exact->inexact") -@deffn primitive exact->inexact z +@deffn {Scheme Procedure} exact->inexact z Convert the number @var{z} to its inexact representation. @end deffn @@ -508,23 +520,25 @@ multiplying by 10^N. @rnindex gcd @rnindex lcm -@deffn primitive odd? n +@deffn {Scheme Procedure} odd? n +@deffnx {C Function} scm_odd_p (n) Return @code{#t} if @var{n} is an odd number, @code{#f} otherwise. @end deffn -@deffn primitive even? n +@deffn {Scheme Procedure} even? n +@deffnx {C Function} scm_even_p (n) Return @code{#t} if @var{n} is an even number, @code{#f} otherwise. @end deffn @c begin (texi-doc-string "guile" "quotient") -@deffn primitive quotient +@deffn {Scheme Procedure} quotient Return the quotient of the numbers @var{x} and @var{y}. @end deffn @c begin (texi-doc-string "guile" "remainder") -@deffn primitive remainder +@deffn {Scheme Procedure} remainder Return the remainder of the numbers @var{x} and @var{y}. @lisp (remainder 13 4) @result{} 1 @@ -533,7 +547,7 @@ Return the remainder of the numbers @var{x} and @var{y}. @end deffn @c begin (texi-doc-string "guile" "modulo") -@deffn primitive modulo +@deffn {Scheme Procedure} modulo Return the modulo of the numbers @var{x} and @var{y}. @lisp (modulo 13 4) @result{} 1 @@ -542,13 +556,13 @@ Return the modulo of the numbers @var{x} and @var{y}. @end deffn @c begin (texi-doc-string "guile" "gcd") -@deffn primitive gcd +@deffn {Scheme Procedure} gcd Return the greatest common divisor of all arguments. If called without arguments, 0 is returned. @end deffn @c begin (texi-doc-string "guile" "lcm") -@deffn primitive lcm +@deffn {Scheme Procedure} lcm Return the least common multiple of the arguments. If called without arguments, 1 is returned. @end deffn @@ -561,48 +575,48 @@ If called without arguments, 1 is returned. @rnindex negative? @c begin (texi-doc-string "guile" "=") -@deffn primitive = +@deffn {Scheme Procedure} = Return @code{#t} if all parameters are numerically equal. @end deffn @c begin (texi-doc-string "guile" "<") -@deffn primitive < +@deffn {Scheme Procedure} < Return @code{#t} if the list of parameters is monotonically increasing. @end deffn @c begin (texi-doc-string "guile" ">") -@deffn primitive > +@deffn {Scheme Procedure} > Return @code{#t} if the list of parameters is monotonically decreasing. @end deffn @c begin (texi-doc-string "guile" "<=") -@deffn primitive <= +@deffn {Scheme Procedure} <= Return @code{#t} if the list of parameters is monotonically non-decreasing. @end deffn @c begin (texi-doc-string "guile" ">=") -@deffn primitive >= +@deffn {Scheme Procedure} >= Return @code{#t} if the list of parameters is monotonically non-increasing. @end deffn @c begin (texi-doc-string "guile" "zero?") -@deffn primitive zero? +@deffn {Scheme Procedure} zero? Return @code{#t} if @var{z} is an exact or inexact number equal to zero. @end deffn @c begin (texi-doc-string "guile" "positive?") -@deffn primitive positive? +@deffn {Scheme Procedure} positive? Return @code{#t} if @var{x} is an exact or inexact number greater than zero. @end deffn @c begin (texi-doc-string "guile" "negative?") -@deffn primitive negative? +@deffn {Scheme Procedure} negative? Return @code{#t} if @var{x} is an exact or inexact number less than zero. @end deffn @@ -613,13 +627,15 @@ zero. @rnindex number->string @rnindex string->number -@deffn primitive number->string n [radix] +@deffn {Scheme Procedure} number->string n [radix] +@deffnx {C Function} scm_number_to_string (n, radix) Return a string holding the external representation of the number @var{n} in the given @var{radix}. If @var{n} is inexact, a radix of 10 will be used. @end deffn -@deffn primitive string->number string [radix] +@deffn {Scheme Procedure} string->number string [radix] +@deffnx {C Function} scm_string_to_number (string, radix) Return a number of the maximally precise representation expressed by the given @var{string}. @var{radix} must be an exact integer, either 2, 8, 10, or 16. If supplied, @var{radix} @@ -640,33 +656,35 @@ syntactically valid notation for a number, then @rnindex magnitude @rnindex angle -@deffn primitive make-rectangular real imaginary +@deffn {Scheme Procedure} make-rectangular real imaginary +@deffnx {C Function} scm_make_rectangular (real, imaginary) Return a complex number constructed of the given @var{real} and @var{imaginary} parts. @end deffn -@deffn primitive make-polar x y +@deffn {Scheme Procedure} make-polar x y +@deffnx {C Function} scm_make_polar (x, y) Return the complex number @var{x} * e^(i * @var{y}). @end deffn @c begin (texi-doc-string "guile" "real-part") -@deffn primitive real-part +@deffn {Scheme Procedure} real-part Return the real part of the number @var{z}. @end deffn @c begin (texi-doc-string "guile" "imag-part") -@deffn primitive imag-part +@deffn {Scheme Procedure} imag-part Return the imaginary part of the number @var{z}. @end deffn @c begin (texi-doc-string "guile" "magnitude") -@deffn primitive magnitude +@deffn {Scheme Procedure} magnitude Return the magnitude of the number @var{z}. This is the same as @code{abs} for real arguments, but also allows complex numbers. @end deffn @c begin (texi-doc-string "guile" "angle") -@deffn primitive angle +@deffn {Scheme Procedure} angle Return the angle of the complex number @var{z}. @end deffn @@ -686,62 +704,62 @@ Return the angle of the complex number @var{z}. @rnindex round @c begin (texi-doc-string "guile" "+") -@deffn primitive + z1 @dots{} +@deffn {Scheme Procedure} + z1 @dots{} Return the sum of all parameter values. Return 0 if called without any parameters. @end deffn @c begin (texi-doc-string "guile" "-") -@deffn primitive - z1 z2 @dots{} +@deffn {Scheme Procedure} - z1 z2 @dots{} If called with one argument @var{z1}, -@var{z1} is returned. Otherwise the sum of all but the first argument are subtracted from the first argument. @end deffn @c begin (texi-doc-string "guile" "*") -@deffn primitive * z1 @dots{} +@deffn {Scheme Procedure} * z1 @dots{} Return the product of all arguments. If called without arguments, 1 is returned. @end deffn @c begin (texi-doc-string "guile" "/") -@deffn primitive / z1 z2 @dots{} +@deffn {Scheme Procedure} / z1 z2 @dots{} Divide the first argument by the product of the remaining arguments. If called with one argument @var{z1}, 1/@var{z1} is returned. @end deffn @c begin (texi-doc-string "guile" "abs") -@deffn primitive abs x +@deffn {Scheme Procedure} abs x Return the absolute value of @var{x}. @end deffn @c begin (texi-doc-string "guile" "max") -@deffn primitive max x1 x2 @dots{} +@deffn {Scheme Procedure} max x1 x2 @dots{} Return the maximum of all parameter values. @end deffn @c begin (texi-doc-string "guile" "min") -@deffn primitive min x1 x2 @dots{} +@deffn {Scheme Procedure} min x1 x2 @dots{} Return the minium of all parameter values. @end deffn @c begin (texi-doc-string "guile" "truncate") -@deffn primitive truncate +@deffn {Scheme Procedure} truncate Round the inexact number @var{x} towards zero. @end deffn @c begin (texi-doc-string "guile" "round") -@deffn primitive round x +@deffn {Scheme Procedure} round x Round the inexact number @var{x} towards zero. @end deffn @c begin (texi-doc-string "guile" "floor") -@deffn primitive floor x +@deffn {Scheme Procedure} floor x Round the number @var{x} towards minus infinity. @end deffn @c begin (texi-doc-string "guile" "ceiling") -@deffn primitive ceiling x +@deffn {Scheme Procedure} ceiling x Round the number @var{x} towards infinity. @end deffn @@ -754,97 +772,97 @@ including complex numbers. @rnindex sqrt @c begin (texi-doc-string "guile" "sqrt") -@deffn procedure sqrt z +@deffn {Scheme Procedure} sqrt z Return the square root of @var{z}. @end deffn @rnindex expt @c begin (texi-doc-string "guile" "expt") -@deffn procedure expt z1 z2 +@deffn {Scheme Procedure} expt z1 z2 Return @var{z1} raised to the power of @var{z2}. @end deffn @rnindex sin @c begin (texi-doc-string "guile" "sin") -@deffn procedure sin z +@deffn {Scheme Procedure} sin z Return the sine of @var{z}. @end deffn @rnindex cos @c begin (texi-doc-string "guile" "cos") -@deffn procedure cos z +@deffn {Scheme Procedure} cos z Return the cosine of @var{z}. @end deffn @rnindex tan @c begin (texi-doc-string "guile" "tan") -@deffn procedure tan z +@deffn {Scheme Procedure} tan z Return the tangent of @var{z}. @end deffn @rnindex asin @c begin (texi-doc-string "guile" "asin") -@deffn procedure asin z +@deffn {Scheme Procedure} asin z Return the arcsine of @var{z}. @end deffn @rnindex acos @c begin (texi-doc-string "guile" "acos") -@deffn procedure acos z +@deffn {Scheme Procedure} acos z Return the arccosine of @var{z}. @end deffn @rnindex atan @c begin (texi-doc-string "guile" "atan") -@deffn procedure atan z +@deffn {Scheme Procedure} atan z Return the arctangent of @var{z}. @end deffn @rnindex exp @c begin (texi-doc-string "guile" "exp") -@deffn procedure exp z +@deffn {Scheme Procedure} exp z Return e to the power of @var{z}, where e is the base of natural logarithms (2.71828@dots{}). @end deffn @rnindex log @c begin (texi-doc-string "guile" "log") -@deffn procedure log z +@deffn {Scheme Procedure} log z Return the natural logarithm of @var{z}. @end deffn @c begin (texi-doc-string "guile" "log10") -@deffn procedure log10 z +@deffn {Scheme Procedure} log10 z Return the base 10 logarithm of @var{z}. @end deffn @c begin (texi-doc-string "guile" "sinh") -@deffn procedure sinh z +@deffn {Scheme Procedure} sinh z Return the hyperbolic sine of @var{z}. @end deffn @c begin (texi-doc-string "guile" "cosh") -@deffn procedure cosh z +@deffn {Scheme Procedure} cosh z Return the hyperbolic cosine of @var{z}. @end deffn @c begin (texi-doc-string "guile" "tanh") -@deffn procedure tanh z +@deffn {Scheme Procedure} tanh z Return the hyperbolic tangent of @var{z}. @end deffn @c begin (texi-doc-string "guile" "asinh") -@deffn procedure asinh z +@deffn {Scheme Procedure} asinh z Return the hyperbolic arcsine of @var{z}. @end deffn @c begin (texi-doc-string "guile" "acosh") -@deffn procedure acosh z +@deffn {Scheme Procedure} acosh z Return the hyperbolic arccosine of @var{z}. @end deffn @c begin (texi-doc-string "guile" "atanh") -@deffn procedure atanh z +@deffn {Scheme Procedure} atanh z Return the hyperbolic arctangent of @var{z}. @end deffn @@ -858,51 +876,53 @@ procedures that use the following real number-based primitives. These primitives signal an error if they are called with complex arguments. @c begin (texi-doc-string "guile" "$abs") -@deffn primitive $abs x +@deffn {Scheme Procedure} $abs x Return the absolute value of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$sqrt") -@deffn primitive $sqrt x +@deffn {Scheme Procedure} $sqrt x Return the square root of @var{x}. @end deffn -@deffn primitive $expt x y +@deffn {Scheme Procedure} $expt x y +@deffnx {C Function} scm_sys_expt (x, y) Return @var{x} raised to the power of @var{y}. This procedure does not accept complex arguments. @end deffn @c begin (texi-doc-string "guile" "$sin") -@deffn primitive $sin x +@deffn {Scheme Procedure} $sin x Return the sine of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$cos") -@deffn primitive $cos x +@deffn {Scheme Procedure} $cos x Return the cosine of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$tan") -@deffn primitive $tan x +@deffn {Scheme Procedure} $tan x Return the tangent of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$asin") -@deffn primitive $asin x +@deffn {Scheme Procedure} $asin x Return the arcsine of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$acos") -@deffn primitive $acos x +@deffn {Scheme Procedure} $acos x Return the arccosine of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$atan") -@deffn primitive $atan x +@deffn {Scheme Procedure} $atan x Return the arctangent of @var{x} in the range -PI/2 to PI/2. @end deffn -@deffn primitive $atan2 x y +@deffn {Scheme Procedure} $atan2 x y +@deffnx {C Function} scm_sys_atan2 (x, y) Return the arc tangent of the two arguments @var{x} and @var{y}. This is similar to calculating the arc tangent of @var{x} / @var{y}, except that the signs of both arguments @@ -911,43 +931,43 @@ procedure does not accept complex arguments. @end deffn @c begin (texi-doc-string "guile" "$exp") -@deffn primitive $exp x +@deffn {Scheme Procedure} $exp x Return e to the power of @var{x}, where e is the base of natural logarithms (2.71828@dots{}). @end deffn @c begin (texi-doc-string "guile" "$log") -@deffn primitive $log x +@deffn {Scheme Procedure} $log x Return the natural logarithm of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$sinh") -@deffn primitive $sinh x +@deffn {Scheme Procedure} $sinh x Return the hyperbolic sine of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$cosh") -@deffn primitive $cosh x +@deffn {Scheme Procedure} $cosh x Return the hyperbolic cosine of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$tanh") -@deffn primitive $tanh x +@deffn {Scheme Procedure} $tanh x Return the hyperbolic tangent of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$asinh") -@deffn primitive $asinh x +@deffn {Scheme Procedure} $asinh x Return the hyperbolic arcsine of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$acosh") -@deffn primitive $acosh x +@deffn {Scheme Procedure} $acosh x Return the hyperbolic arccosine of @var{x}. @end deffn @c begin (texi-doc-string "guile" "$atanh") -@deffn primitive $atanh x +@deffn {Scheme Procedure} $atanh x Return the hyperbolic arctangent of @var{x}. @end deffn @@ -955,7 +975,7 @@ Return the hyperbolic arctangent of @var{x}. @node Bitwise Operations @subsection Bitwise Operations -@deffn primitive logand n1 n2 +@deffn {Scheme Procedure} logand n1 n2 Return the bitwise AND of the integer arguments. @lisp @@ -965,7 +985,7 @@ Return the bitwise AND of the integer arguments. @end lisp @end deffn -@deffn primitive logior n1 n2 +@deffn {Scheme Procedure} logior n1 n2 Return the bitwise OR of the integer arguments. @lisp @@ -975,7 +995,7 @@ Return the bitwise OR of the integer arguments. @end lisp @end deffn -@deffn primitive logxor n1 n2 +@deffn {Scheme Procedure} logxor n1 n2 Return the bitwise XOR of the integer arguments. A bit is set in the result if it is set in an odd number of arguments. @lisp @@ -986,7 +1006,8 @@ set in the result if it is set in an odd number of arguments. @end lisp @end deffn -@deffn primitive lognot n +@deffn {Scheme Procedure} lognot n +@deffnx {C Function} scm_lognot (n) Return the integer which is the 2s-complement of the integer argument. @@ -998,7 +1019,8 @@ argument. @end lisp @end deffn -@deffn primitive logtest j k +@deffn {Scheme Procedure} logtest j k +@deffnx {C Function} scm_logtest (j, k) @lisp (logtest j k) @equiv{} (not (zero? (logand j k))) @@ -1007,7 +1029,8 @@ argument. @end lisp @end deffn -@deffn primitive logbit? index j +@deffn {Scheme Procedure} logbit? index j +@deffnx {C Function} scm_logbit_p (index, j) @lisp (logbit? index j) @equiv{} (logtest (integer-expt 2 index) j) @@ -1019,7 +1042,8 @@ argument. @end lisp @end deffn -@deffn primitive ash n cnt +@deffn {Scheme Procedure} ash n cnt +@deffnx {C Function} scm_ash (n, cnt) The function ash performs an arithmetic shift left by @var{cnt} bits (or shift right, if @var{cnt} is negative). 'Arithmetic' means, that the function does not guarantee to keep the bit @@ -1037,7 +1061,8 @@ Formally, the function returns an integer equivalent to @end lisp @end deffn -@deffn primitive logcount n +@deffn {Scheme Procedure} logcount n +@deffnx {C Function} scm_logcount (n) Return the number of bits in integer @var{n}. If integer is positive, the 1-bits in its binary representation are counted. If negative, the 0-bits in its two's-complement binary @@ -1053,7 +1078,8 @@ representation are counted. If 0, 0 is returned. @end lisp @end deffn -@deffn primitive integer-length n +@deffn {Scheme Procedure} integer-length n +@deffnx {C Function} scm_integer_length (n) Return the number of bits neccessary to represent @var{n}. @lisp @@ -1066,7 +1092,8 @@ Return the number of bits neccessary to represent @var{n}. @end lisp @end deffn -@deffn primitive integer-expt n k +@deffn {Scheme Procedure} integer-expt n k +@deffnx {C Function} scm_integer_expt (n, k) Return @var{n} raised to the non-negative integer exponent @var{k}. @@ -1078,7 +1105,8 @@ Return @var{n} raised to the non-negative integer exponent @end lisp @end deffn -@deffn primitive bit-extract n start end +@deffn {Scheme Procedure} bit-extract n start end +@deffnx {C Function} scm_bit_extract (n, start, end) Return the integer composed of the @var{start} (inclusive) through @var{end} (exclusive) bits of @var{n}. The @var{start}th bit becomes the 0-th bit in the result. @@ -1095,11 +1123,13 @@ through @var{end} (exclusive) bits of @var{n}. The @node Random @subsection Random Number Generation -@deffn primitive copy-random-state [state] +@deffn {Scheme Procedure} copy-random-state [state] +@deffnx {C Function} scm_copy_random_state (state) Return a copy of the random state @var{state}. @end deffn -@deffn primitive random n [state] +@deffn {Scheme Procedure} random n [state] +@deffnx {C Function} scm_random (n, state) Return a number in [0,N). Accepts a positive integer or real n and returns a @@ -1114,13 +1144,15 @@ the state of the pseudo-random-number generator and is altered as a side effect of the random operation. @end deffn -@deffn primitive random:exp [state] +@deffn {Scheme Procedure} random:exp [state] +@deffnx {C Function} scm_random_exp (state) Return an inexact real in an exponential distribution with mean 1. For an exponential distribution with mean u use (* u (random:exp)). @end deffn -@deffn primitive random:hollow-sphere! v [state] +@deffn {Scheme Procedure} random:hollow-sphere! v [state] +@deffnx {C Function} scm_random_hollow_sphere_x (v, state) Fills vect with inexact real random numbers the sum of whose squares is equal to 1.0. Thinking of vect as coordinates in space of @@ -1129,20 +1161,23 @@ are uniformly distributed over the surface of the unit n-sphere. @end deffn -@deffn primitive random:normal [state] +@deffn {Scheme Procedure} random:normal [state] +@deffnx {C Function} scm_random_normal (state) Return an inexact real in a normal distribution. The distribution used has mean 0 and standard deviation 1. For a normal distribution with mean m and standard deviation d use @code{(+ m (* d (random:normal)))}. @end deffn -@deffn primitive random:normal-vector! v [state] +@deffn {Scheme Procedure} random:normal-vector! v [state] +@deffnx {C Function} scm_random_normal_vector_x (v, state) Fills vect with inexact real random numbers that are independent and standard normally distributed (i.e., with mean 0 and variance 1). @end deffn -@deffn primitive random:solid-sphere! v [state] +@deffn {Scheme Procedure} random:solid-sphere! v [state] +@deffnx {C Function} scm_random_solid_sphere_x (v, state) Fills vect with inexact real random numbers the sum of whose squares is less than 1.0. Thinking of vect as coordinates in space of @@ -1151,12 +1186,14 @@ are uniformly distributed within the unit n-sphere. The sum of the squares of the numbers is returned. @end deffn -@deffn primitive random:uniform [state] +@deffn {Scheme Procedure} random:uniform [state] +@deffnx {C Function} scm_random_uniform (state) Return a uniformly distributed inexact real random number in [0,1). @end deffn -@deffn primitive seed->random-state seed +@deffn {Scheme Procedure} seed->random-state seed +@deffnx {C Function} scm_seed_to_random_state (seed) Return a new random state using @var{seed}. @end deffn @@ -1228,123 +1265,134 @@ Several characters have more than one name: @end itemize @rnindex char? -@deffn primitive char? x +@deffn {Scheme Procedure} char? x +@deffnx {C Function} scm_char_p (x) Return @code{#t} iff @var{x} is a character, else @code{#f}. @end deffn @rnindex char=? -@deffn primitive char=? x y +@deffn {Scheme Procedure} char=? x y Return @code{#t} iff @var{x} is the same character as @var{y}, else @code{#f}. @end deffn @rnindex char<? -@deffn primitive char<? x y +@deffn {Scheme Procedure} char<? x y Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence, else @code{#f}. @end deffn @rnindex char<=? -@deffn primitive char<=? x y +@deffn {Scheme Procedure} char<=? x y Return @code{#t} iff @var{x} is less than or equal to @var{y} in the ASCII sequence, else @code{#f}. @end deffn @rnindex char>? -@deffn primitive char>? x y +@deffn {Scheme Procedure} char>? x y Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII sequence, else @code{#f}. @end deffn @rnindex char>=? -@deffn primitive char>=? x y +@deffn {Scheme Procedure} char>=? x y Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the ASCII sequence, else @code{#f}. @end deffn @rnindex char-ci=? -@deffn primitive char-ci=? x y +@deffn {Scheme Procedure} char-ci=? x y Return @code{#t} iff @var{x} is the same character as @var{y} ignoring case, else @code{#f}. @end deffn @rnindex char-ci<? -@deffn primitive char-ci<? x y +@deffn {Scheme Procedure} char-ci<? x y Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence ignoring case, else @code{#f}. @end deffn @rnindex char-ci<=? -@deffn primitive char-ci<=? x y +@deffn {Scheme Procedure} char-ci<=? x y Return @code{#t} iff @var{x} is less than or equal to @var{y} in the ASCII sequence ignoring case, else @code{#f}. @end deffn @rnindex char-ci>? -@deffn primitive char-ci>? x y +@deffn {Scheme Procedure} char-ci>? x y Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII sequence ignoring case, else @code{#f}. @end deffn @rnindex char-ci>=? -@deffn primitive char-ci>=? x y +@deffn {Scheme Procedure} char-ci>=? x y Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the ASCII sequence ignoring case, else @code{#f}. @end deffn @rnindex char-alphabetic? -@deffn primitive char-alphabetic? chr +@deffn {Scheme Procedure} char-alphabetic? chr +@deffnx {C Function} scm_char_alphabetic_p (chr) Return @code{#t} iff @var{chr} is alphabetic, else @code{#f}. Alphabetic means the same thing as the isalpha C library function. @end deffn @rnindex char-numeric? -@deffn primitive char-numeric? chr +@deffn {Scheme Procedure} char-numeric? chr +@deffnx {C Function} scm_char_numeric_p (chr) Return @code{#t} iff @var{chr} is numeric, else @code{#f}. Numeric means the same thing as the isdigit C library function. @end deffn @rnindex char-whitespace? -@deffn primitive char-whitespace? chr +@deffn {Scheme Procedure} char-whitespace? chr +@deffnx {C Function} scm_char_whitespace_p (chr) Return @code{#t} iff @var{chr} is whitespace, else @code{#f}. Whitespace means the same thing as the isspace C library function. @end deffn @rnindex char-upper-case? -@deffn primitive char-upper-case? chr +@deffn {Scheme Procedure} char-upper-case? chr +@deffnx {C Function} scm_char_upper_case_p (chr) Return @code{#t} iff @var{chr} is uppercase, else @code{#f}. Uppercase means the same thing as the isupper C library function. @end deffn @rnindex char-lower-case? -@deffn primitive char-lower-case? chr +@deffn {Scheme Procedure} char-lower-case? chr +@deffnx {C Function} scm_char_lower_case_p (chr) Return @code{#t} iff @var{chr} is lowercase, else @code{#f}. Lowercase means the same thing as the islower C library function. @end deffn -@deffn primitive char-is-both? chr +@deffn {Scheme Procedure} char-is-both? chr +@deffnx {C Function} scm_char_is_both_p (chr) Return @code{#t} iff @var{chr} is either uppercase or lowercase, else @code{#f}. Uppercase and lowercase are as defined by the isupper and islower C library functions. @end deffn @rnindex char->integer -@deffn primitive char->integer chr +@deffn {Scheme Procedure} char->integer chr +@deffnx {C Function} scm_char_to_integer (chr) Return the number corresponding to ordinal position of @var{chr} in the ASCII sequence. @end deffn @rnindex integer->char -@deffn primitive integer->char n +@deffn {Scheme Procedure} integer->char n +@deffnx {C Function} scm_integer_to_char (n) Return the character at position @var{n} in the ASCII sequence. @end deffn @rnindex char-upcase -@deffn primitive char-upcase chr +@deffn {Scheme Procedure} char-upcase chr +@deffnx {C Function} scm_char_upcase (chr) Return the uppercase character version of @var{chr}. @end deffn @rnindex char-downcase -@deffn primitive char-downcase chr +@deffn {Scheme Procedure} char-downcase chr +@deffnx {C Function} scm_char_downcase (chr) Return the lowercase character version of @var{chr}. @end deffn @@ -1410,11 +1458,13 @@ The following procedures can be used to check whether a given string fulfills some specified property. @rnindex string? -@deffn primitive string? obj +@deffn {Scheme Procedure} string? obj +@deffnx {C Function} scm_string_p (obj) Return @code{#t} iff @var{obj} is a string, else @code{#f}. @end deffn -@deffn primitive string-null? str +@deffn {Scheme Procedure} string-null? str +@deffnx {C Function} scm_string_null_p (str) Return @code{#t} if @var{str}'s length is zero, and @code{#f} otherwise. @lisp @@ -1434,14 +1484,16 @@ initializing them with some specified character data. @rnindex string @rnindex list->string -@deffn primitive string . chrs -@deffnx primitive list->string chrs +@deffn {Scheme Procedure} string . chrs +@deffnx {Scheme Procedure} list->string chrs +@deffnx {C Function} scm_string (chrs) Return a newly allocated string composed of the arguments, @var{chrs}. @end deffn @rnindex make-string -@deffn primitive make-string k [chr] +@deffn {Scheme Procedure} make-string k [chr] +@deffnx {C Function} scm_make_string (k, chr) Return a newly allocated string of length @var{k}. If @var{chr} is given, then all elements of the string are initialized to @var{chr}, otherwise the contents @@ -1457,14 +1509,16 @@ work with the resulting list, and then convert it back into a string. These procedures are useful for similar tasks. @rnindex string->list -@deffn primitive string->list str +@deffn {Scheme Procedure} string->list str +@deffnx {C Function} scm_string_to_list (str) Return a newly allocated list of the characters that make up the given string @var{str}. @code{string->list} and @code{list->string} are inverses as far as @samp{equal?} is concerned. @end deffn -@deffn primitive string-split str chr +@deffn {Scheme Procedure} string-split str chr +@deffnx {C Function} scm_string_split (str, chr) Split the string @var{str} into the a list of the substrings delimited by appearances of the character @var{chr}. Note that an empty substring between separator characters will result in an empty string in the @@ -1494,23 +1548,27 @@ Portions of strings can be extracted by these procedures. @code{substring} can be used to extract substrings from longer strings. @rnindex string-length -@deffn primitive string-length string +@deffn {Scheme Procedure} string-length string +@deffnx {C Function} scm_string_length (string) Return the number of characters in @var{string}. @end deffn @rnindex string-ref -@deffn primitive string-ref str k +@deffn {Scheme Procedure} string-ref str k +@deffnx {C Function} scm_string_ref (str, k) Return character @var{k} of @var{str} using zero-origin indexing. @var{k} must be a valid index of @var{str}. @end deffn @rnindex string-copy -@deffn primitive string-copy str +@deffn {Scheme Procedure} string-copy str +@deffnx {C Function} scm_string_copy (str) Return a newly allocated copy of the given @var{string}. @end deffn @rnindex substring -@deffn primitive substring str start [end] +@deffn {Scheme Procedure} substring str start [end] +@deffnx {C Function} scm_substring (str, start, end) Return a newly allocated string formed from the characters of @var{str} beginning with index @var{start} (inclusive) and ending with index @var{end} (exclusive). @@ -1528,19 +1586,22 @@ result of the operation is not a new string; instead, the original string's memory representation is modified. @rnindex string-set! -@deffn primitive string-set! str k chr +@deffn {Scheme Procedure} string-set! str k chr +@deffnx {C Function} scm_string_set_x (str, k, chr) Store @var{chr} in element @var{k} of @var{str} and return an unspecified value. @var{k} must be a valid index of @var{str}. @end deffn @rnindex string-fill! -@deffn primitive string-fill! str chr +@deffn {Scheme Procedure} string-fill! str chr +@deffnx {C Function} scm_string_fill_x (str, chr) Store @var{char} in every element of the given @var{string} and return an unspecified value. @end deffn -@deffn primitive substring-fill! str start end fill +@deffn {Scheme Procedure} substring-fill! str start end fill +@deffnx {C Function} scm_substring_fill_x (str, start, end, fill) Change every character in @var{str} between @var{start} and @var{end} to @var{fill}. @@ -1552,56 +1613,11 @@ y @end lisp @end deffn -@deffn primitive substring-move! str1 start1 end1 str2 start2 -@deffnx primitive substring-move-left! str1 start1 end1 str2 start2 -@deffnx primitive substring-move-right! str1 start1 end1 str2 start2 +@deffn {Scheme Procedure} substring-move! str1 start1 end1 str2 start2 +@deffnx {C Function} scm_substring_move_x (str1, start1, end1, str2, start2) Copy the substring of @var{str1} bounded by @var{start1} and @var{end1} into @var{str2} beginning at position @var{start2}. -@code{substring-move-right!} begins copying from the rightmost character -and moves left, and @code{substring-move-left!} copies from the leftmost -character moving right. - -It is useful to have two functions that copy in different directions so -that substrings can be copied back and forth within a single string. If -you wish to copy text from the left-hand side of a string to the -right-hand side of the same string, and the source and destination -overlap, you must be careful to copy the rightmost characters of the -text first, to avoid clobbering your data. Hence, when @var{str1} and -@var{str2} are the same string, you should use -@code{substring-move-right!} when moving text from left to right, and -@code{substring-move-left!} otherwise. If @code{str1} and @samp{str2} -are different strings, it does not matter which function you use. - -@example -(define x (make-string 10 #\a)) -(define y "bcd") -(substring-move-left! x 2 5 y 0) -y -@result{} "aaa" - -x -@result{} "aaaaaaaaaa" - -(define y "bcdefg") -(substring-move-left! x 2 5 y 0) -y -@result{} "aaaefg" - -(define y "abcdefg") -(substring-move-left! y 2 5 y 3) -y -@result{} "abccccg" - -(define y "abcdefg") -(substring-move-right! y 2 5 y 0) -y -@result{} "ededefg" - -(define y "abcdefg") -(substring-move-right! y 2 5 y 3) -y -@result{} "abccdeg" -@end example +@var{str1} and @var{str2} can be the same string. @end deffn @@ -1616,7 +1632,7 @@ strings. @rnindex string=? -@deffn primitive string=? s1 s2 +@deffn {Scheme Procedure} string=? s1 s2 Lexicographic equality predicate; return @code{#t} if the two strings are the same length and contain the same characters in the same positions, otherwise return @code{#f}. @@ -1628,31 +1644,31 @@ characters. @end deffn @rnindex string<? -@deffn primitive string<? s1 s2 +@deffn {Scheme Procedure} string<? s1 s2 Lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically less than @var{s2}. @end deffn @rnindex string<=? -@deffn primitive string<=? s1 s2 +@deffn {Scheme Procedure} string<=? s1 s2 Lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically less than or equal to @var{s2}. @end deffn @rnindex string>? -@deffn primitive string>? s1 s2 +@deffn {Scheme Procedure} string>? s1 s2 Lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically greater than @var{s2}. @end deffn @rnindex string>=? -@deffn primitive string>=? s1 s2 +@deffn {Scheme Procedure} string>=? s1 s2 Lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically greater than or equal to @var{s2}. @end deffn @rnindex string-ci=? -@deffn primitive string-ci=? s1 s2 +@deffn {Scheme Procedure} string-ci=? s1 s2 Case-insensitive string equality predicate; return @code{#t} if the two strings are the same length and their component characters match (ignoring case) at each position; otherwise @@ -1660,28 +1676,28 @@ return @code{#f}. @end deffn @rnindex string-ci< -@deffn primitive string-ci<? s1 s2 +@deffn {Scheme Procedure} string-ci<? s1 s2 Case insensitive lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically less than @var{s2} regardless of case. @end deffn @rnindex string<=? -@deffn primitive string-ci<=? s1 s2 +@deffn {Scheme Procedure} string-ci<=? s1 s2 Case insensitive lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically less than or equal to @var{s2} regardless of case. @end deffn @rnindex string-ci>? -@deffn primitive string-ci>? s1 s2 +@deffn {Scheme Procedure} string-ci>? s1 s2 Case insensitive lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically greater than @var{s2} regardless of case. @end deffn @rnindex string-ci>=? -@deffn primitive string-ci>=? s1 s2 +@deffn {Scheme Procedure} string-ci>=? s1 s2 Case insensitive lexicographic ordering predicate; return @code{#t} if @var{s1} is lexicographically greater than or equal to @var{s2} regardless of case. @@ -1694,7 +1710,8 @@ equal to @var{s2} regardless of case. When searching for the index of a character in a string, these procedures can be used. -@deffn primitive string-index str chr [frm [to]] +@deffn {Scheme Procedure} string-index str chr [frm [to]] +@deffnx {C Function} scm_string_index (str, chr, frm, to) Return the index of the first occurrence of @var{chr} in @var{str}. The optional integer arguments @var{frm} and @var{to} limit the search to a portion of the string. This @@ -1713,7 +1730,8 @@ procedure essentially implements the @code{index} or @end lisp @end deffn -@deffn primitive string-rindex str chr [frm [to]] +@deffn {Scheme Procedure} string-rindex str chr [frm [to]] +@deffnx {C Function} scm_string_rindex (str, chr, frm, to) Like @code{string-index}, but search from the right of the string rather than from the left. This procedure essentially implements the @code{rindex} or @code{strrchr} functions from @@ -1737,12 +1755,14 @@ the C library. These are procedures for mapping strings to their upper- or lower-case equivalents, respectively, or for capitalizing strings. -@deffn primitive string-upcase str +@deffn {Scheme Procedure} string-upcase str +@deffnx {C Function} scm_string_upcase (str) Return a freshly allocated string containing the characters of @var{str} in upper case. @end deffn -@deffn primitive string-upcase! str +@deffn {Scheme Procedure} string-upcase! str +@deffnx {C Function} scm_string_upcase_x (str) Destructively upcase every character in @var{str} and return @var{str}. @lisp @@ -1752,12 +1772,14 @@ y @result{} "ARRDEFG" @end lisp @end deffn -@deffn primitive string-downcase str +@deffn {Scheme Procedure} string-downcase str +@deffnx {C Function} scm_string_downcase (str) Return a freshly allocation string containing the characters in @var{str} in lower case. @end deffn -@deffn primitive string-downcase! str +@deffn {Scheme Procedure} string-downcase! str +@deffnx {C Function} scm_string_downcase_x (str) Destructively downcase every character in @var{str} and return @var{str}. @lisp @@ -1767,13 +1789,15 @@ y @result{} "arrdefg" @end lisp @end deffn -@deffn primitive string-capitalize str +@deffn {Scheme Procedure} string-capitalize str +@deffnx {C Function} scm_string_capitalize (str) Return a freshly allocated string with the characters in @var{str}, where the first character of every word is capitalized. @end deffn -@deffn primitive string-capitalize! str +@deffn {Scheme Procedure} string-capitalize! str +@deffnx {C Function} scm_string_capitalize_x (str) Upcase the first character of every word in @var{str} destructively and return @var{str}. @@ -1792,9 +1816,10 @@ The procedure @code{string-append} appends several strings together to form a longer result string. @rnindex string-append -@deffn primitive string-append string1 @dots{} +@deffn {Scheme Procedure} string-append . args +@deffnx {C Function} scm_string_append (args) Return a newly allocated string whose characters form the -concatenation of the given strings. +concatenation of the given strings, @var{args}. @end deffn @@ -1803,7 +1828,8 @@ concatenation of the given strings. This section contains all remaining string procedures. -@deffn primitive string-ci->symbol str +@deffn {Scheme Procedure} string-ci->symbol str +@deffnx {C Function} scm_string_ci_to_symbol (str) Return the symbol whose name is @var{str}. @var{str} is converted to lowercase before the conversion is done, if Guile is currently reading symbols case-insensitively. @@ -1854,7 +1880,7 @@ implemented by SCSH, the Scheme Shell. It is intended to be upwardly compatible with SCSH regular expressions. @c begin (scm-doc-string "regex.scm" "string-match") -@deffn procedure string-match pattern str [start] +@deffn {Scheme Procedure} string-match pattern str [start] Compile the string @var{pattern} into a regular expression and compare it with @var{str}. The optional numeric argument @var{start} specifies the position of @var{str} at which to begin matching. @@ -1872,7 +1898,8 @@ the same regular expression is used several times (for example, in a loop). For better performance, you can compile a regular expression in advance and then match strings against the compiled regexp. -@deffn primitive make-regexp pat . flags +@deffn {Scheme Procedure} make-regexp pat . flags +@deffnx {C Function} scm_make_regexp (pat, flags) Compile the regular expression described by @var{pat}, and return the compiled regexp structure. If @var{pat} does not describe a legal regular expression, @code{make-regexp} throws @@ -1912,7 +1939,8 @@ one which comes last will override the earlier one. @end table @end deffn -@deffn primitive regexp-exec rx str [start [flags]] +@deffn {Scheme Procedure} regexp-exec rx str [start [flags]] +@deffnx {C Function} scm_regexp_exec (rx, str, start, flags) Match the compiled regular expression @var{rx} against @code{str}. If the optional integer @var{start} argument is provided, begin matching from that position in the string. @@ -1934,7 +1962,8 @@ considered the end of a line. @end table @end deffn -@deffn primitive regexp? obj +@deffn {Scheme Procedure} regexp? obj +@deffnx {C Function} scm_regexp_p (obj) Return @code{#t} if @var{obj} is a compiled regular expression, or @code{#f} otherwise. @end deffn @@ -1943,7 +1972,7 @@ Regular expressions are commonly used to find patterns in one string and replace them with the contents of another string. @c begin (scm-doc-string "regex.scm" "regexp-substitute") -@deffn procedure regexp-substitute port match [item@dots{}] +@deffn {Scheme Procedure} regexp-substitute port match [item@dots{}] Write to the output port @var{port} selected contents of the match structure @var{match}. Each @var{item} specifies what should be written, and may be one of the following arguments: @@ -1970,7 +1999,7 @@ the regexp match is written. @end deffn @c begin (scm-doc-string "regex.scm" "regexp-substitute") -@deffn procedure regexp-substitute/global port regexp target [item@dots{}] +@deffn {Scheme Procedure} regexp-substitute/global port regexp target [item@dots{}] Similar to @code{regexp-substitute}, but can be used to perform global substitutions on @var{str}. Instead of taking a match structure as an argument, @code{regexp-substitute/global} takes two string arguments: a @@ -2016,13 +2045,13 @@ matched against a regular expression; we will call that string @var{target} for easy reference. @c begin (scm-doc-string "regex.scm" "regexp-match?") -@deffn procedure regexp-match? obj +@deffn {Scheme Procedure} regexp-match? obj Return @code{#t} if @var{obj} is a match structure returned by a previous call to @code{regexp-exec}, or @code{#f} otherwise. @end deffn @c begin (scm-doc-string "regex.scm" "match:substring") -@deffn procedure match:substring match [n] +@deffn {Scheme Procedure} match:substring match [n] Return the portion of @var{target} matched by subexpression number @var{n}. Submatch 0 (the default) represents the entire regexp match. If the regular expression as a whole matched, but the subexpression @@ -2030,34 +2059,34 @@ number @var{n} did not match, return @code{#f}. @end deffn @c begin (scm-doc-string "regex.scm" "match:start") -@deffn procedure match:start match [n] +@deffn {Scheme Procedure} match:start match [n] Return the starting position of submatch number @var{n}. @end deffn @c begin (scm-doc-string "regex.scm" "match:end") -@deffn procedure match:end match [n] +@deffn {Scheme Procedure} match:end match [n] Return the ending position of submatch number @var{n}. @end deffn @c begin (scm-doc-string "regex.scm" "match:prefix") -@deffn procedure match:prefix match +@deffn {Scheme Procedure} match:prefix match Return the unmatched portion of @var{target} preceding the regexp match. @end deffn @c begin (scm-doc-string "regex.scm" "match:suffix") -@deffn procedure match:suffix match +@deffn {Scheme Procedure} match:suffix match Return the unmatched portion of @var{target} following the regexp match. @end deffn @c begin (scm-doc-string "regex.scm" "match:count") -@deffn procedure match:count match +@deffn {Scheme Procedure} match:count match Return the number of parenthesized subexpressions from @var{match}. Note that the entire regular expression match itself counts as a subexpression, and failed submatches are included in the count. @end deffn @c begin (scm-doc-string "regex.scm" "match:string") -@deffn procedure match:string match +@deffn {Scheme Procedure} match:string match Return the original @var{target} string. @end deffn @@ -2091,7 +2120,7 @@ by any number of alphabetic characters. The regular expression regexp each match a single backslash in the target string. @c begin (scm-doc-string "regex.scm" "regexp-quote") -@deffn procedure regexp-quote str +@deffn {Scheme Procedure} regexp-quote str Quote each special character found in @var{str} with a backslash, and return the resulting string. @end deffn @@ -2180,7 +2209,7 @@ guile> The definitions of @code{regcomp} and @code{regexec} are as follows: @c NJFIXME not in libguile! -@deffn primitive regcomp pattern [flags] +@deffn {Scheme Procedure} regcomp pattern [flags] Compile the regular expression pattern using POSIX rules. Flags is optional and should be specified using symbolic names: @defvar REG_EXTENDED @@ -2203,7 +2232,7 @@ literal string e.g., @code{"\\(a\\)\\?"}. @end deffn @c NJFIXME not in libguile! -@deffn primitive regexec regex string [match-pick] [flags] +@deffn {Scheme Procedure} regexec regex string [match-pick] [flags] Match @var{string} against the compiled POSIX regular expression @var{regex}. @@ -2262,32 +2291,32 @@ Here are some other procedures that might be used when using regular expressions: @c NJFIXME not in libguile! -@deffn primitive compiled-regexp? obj +@deffn {Scheme Procedure} compiled-regexp? obj Test whether obj is a compiled regular expression. @end deffn @c NJFIXME not in libguile! -@deffn primitive regexp->dfa regex [flags] +@deffn {Scheme Procedure} regexp->dfa regex [flags] @end deffn @c NJFIXME not in libguile! -@deffn primitive dfa-fork dfa +@deffn {Scheme Procedure} dfa-fork dfa @end deffn @c NJFIXME not in libguile! -@deffn primitive reset-dfa! dfa +@deffn {Scheme Procedure} reset-dfa! dfa @end deffn @c NJFIXME not in libguile! -@deffn primitive dfa-final-tag dfa +@deffn {Scheme Procedure} dfa-final-tag dfa @end deffn @c NJFIXME not in libguile! -@deffn primitive dfa-continuable? dfa +@deffn {Scheme Procedure} dfa-continuable? dfa @end deffn @c NJFIXME not in libguile! -@deffn primitive advance-dfa! dfa string +@deffn {Scheme Procedure} advance-dfa! dfa string @end deffn @@ -2373,13 +2402,15 @@ Usage of this form of read syntax is discouraged, because it is not portable at all, and is not very readable. @rnindex symbol? -@deffn primitive symbol? obj +@deffn {Scheme Procedure} symbol? obj +@deffnx {C Function} scm_symbol_p (obj) Return @code{#t} if @var{obj} is a symbol, otherwise return @code{#f}. @end deffn @rnindex string->symbol -@deffn primitive string->symbol string +@deffn {Scheme Procedure} string->symbol string +@deffnx {C Function} scm_string_to_symbol (string) Return the symbol whose name is @var{string}. This procedure can create symbols with names containing special characters or letters in the non-standard case, but it is usually a bad idea @@ -2403,7 +2434,8 @@ standard case is lower case: @end deffn @rnindex symbol->string -@deffn primitive symbol->string s +@deffn {Scheme Procedure} symbol->string s +@deffnx {C Function} scm_symbol_to_string (s) Return the name of @var{symbol} as a string. If the symbol was part of an object returned as the value of a literal expression (section @pxref{Literal expressions,,,r5rs, The Revised^5 @@ -2446,12 +2478,13 @@ table (with an undefined value) if none is yet present. @c FIXME::martin: According to NEWS, removed. Remove here too, or @c leave for compatibility? @c @c docstring begin (texi-doc-string "guile" "builtin-bindings") -@c @deffn primitive builtin-bindings +@c @deffn {Scheme Procedure} builtin-bindings @c Create and return a copy of the global symbol table, removing all @c unbound symbols. @c @end deffn -@deffn primitive gensym [prefix] +@deffn {Scheme Procedure} gensym [prefix] +@deffnx {C Function} scm_gensym (prefix) Create a new symbol with a name constructed from a prefix and a counter value. The string @var{prefix} can be specified as an optional argument. Default prefix is @code{g}. The counter @@ -2459,7 +2492,7 @@ is increased by 1 at each call. There is no provision for resetting the counter. @end deffn -@deffn primitive gentemp [prefix [obarray]] +@deffn {Scheme Procedure} gentemp [prefix [obarray]] Create a new symbol with a name unique in an obarray. The name is constructed from an optional string @var{prefix} and a counter value. The default prefix is @code{t}. The @@ -2469,25 +2502,25 @@ interned. The counter is increased by 1 at each call. There is no provision for resetting the counter. @end deffn -@deffn primitive intern-symbol obarray string +@deffn {Scheme Procedure} intern-symbol obarray string Add a new symbol to @var{obarray} with name @var{string}, bound to an unspecified initial value. The symbol table is not modified if a symbol with this name is already present. @end deffn -@deffn primitive string->obarray-symbol obarray string [soft?] +@deffn {Scheme Procedure} string->obarray-symbol obarray string [soft?] Intern a new symbol in @var{obarray}, a symbol table, with name @var{string}. @end deffn -@deffn primitive symbol-binding obarray string +@deffn {Scheme Procedure} symbol-binding obarray string Look up in @var{obarray} the symbol whose name is @var{string}, and return the value to which it is bound. If @var{obarray} is @code{#f}, use the global symbol table. If @var{string} is not interned in @var{obarray}, an error is signalled. @end deffn -@deffn primitive symbol-bound? obarray string +@deffn {Scheme Procedure} symbol-bound? obarray string Return @code{#t} if @var{obarray} contains a symbol with name @var{string} bound to a defined value. This differs from @var{symbol-interned?} in that the mere mention of a symbol @@ -2496,38 +2529,43 @@ determines whether a symbol has been given any meaningful value. @end deffn -@deffn primitive symbol-fref symbol +@deffn {Scheme Procedure} symbol-fref symbol +@deffnx {C Function} scm_symbol_fref (symbol) Return the contents of @var{symbol}'s @dfn{function slot}. @end deffn -@deffn primitive symbol-fset! symbol value +@deffn {Scheme Procedure} symbol-fset! symbol value +@deffnx {C Function} scm_symbol_fset_x (symbol, value) Change the binding of @var{symbol}'s function slot. @end deffn -@deffn primitive symbol-hash symbol +@deffn {Scheme Procedure} symbol-hash symbol +@deffnx {C Function} scm_symbol_hash (symbol) Return a hash value for @var{symbol}. @end deffn -@deffn primitive symbol-interned? obarray string +@deffn {Scheme Procedure} symbol-interned? obarray string Return @code{#t} if @var{obarray} contains a symbol with name @var{string}, and @code{#f} otherwise. @end deffn -@deffn primitive symbol-pref symbol +@deffn {Scheme Procedure} symbol-pref symbol +@deffnx {C Function} scm_symbol_pref (symbol) Return the @dfn{property list} currently associated with @var{symbol}. @end deffn -@deffn primitive symbol-pset! symbol value +@deffn {Scheme Procedure} symbol-pset! symbol value +@deffnx {C Function} scm_symbol_pset_x (symbol, value) Change the binding of @var{symbol}'s property slot. @end deffn -@deffn primitive symbol-set! obarray string value +@deffn {Scheme Procedure} symbol-set! obarray string value Find the symbol in @var{obarray} whose name is @var{string}, and rebind it to @var{value}. An error is signalled if @var{string} is not present in @var{obarray}. @end deffn -@deffn primitive unintern-symbol obarray string +@deffn {Scheme Procedure} unintern-symbol obarray string Remove the symbol with name @var{string} from @var{obarray}. This function returns @code{#t} if the symbol was present and @code{#f} otherwise. @@ -2551,38 +2589,44 @@ one of the constructor procedures @code{make-variable} or First-class variables are especially useful for interacting with the current module system (@pxref{The Guile module system}). -@deffn primitive builtin-variable name +@deffn {Scheme Procedure} builtin-variable name Return the built-in variable with the name @var{name}. @var{name} must be a symbol (not a string). Then use @code{variable-ref} to access its value. @end deffn -@deffn primitive make-undefined-variable +@deffn {Scheme Procedure} make-undefined-variable +@deffnx {C Function} scm_make_undefined_variable () Return a variable that is initially unbound. @end deffn -@deffn primitive make-variable init +@deffn {Scheme Procedure} make-variable init +@deffnx {C Function} scm_make_variable (init) Return a variable initialized to value @var{init}. @end deffn -@deffn primitive variable-bound? var +@deffn {Scheme Procedure} variable-bound? var +@deffnx {C Function} scm_variable_bound_p (var) Return @code{#t} iff @var{var} is bound to a value. Throws an error if @var{var} is not a variable object. @end deffn -@deffn primitive variable-ref var +@deffn {Scheme Procedure} variable-ref var +@deffnx {C Function} scm_variable_ref (var) Dereference @var{var} and return its value. @var{var} must be a variable object; see @code{make-variable} and @code{make-undefined-variable}. @end deffn -@deffn primitive variable-set! var val +@deffn {Scheme Procedure} variable-set! var val +@deffnx {C Function} scm_variable_set_x (var, val) Set the value of the variable @var{var} to @var{val}. @var{var} must be a variable object, @var{val} can be any value. Return an unspecified value. @end deffn -@deffn primitive variable? obj +@deffn {Scheme Procedure} variable? obj +@deffnx {C Function} scm_variable_p (obj) Return @code{#t} iff @var{obj} is a variable object, else return @code{#f}. @end deffn @@ -2778,11 +2822,11 @@ ABORT: (unbound-variable) The following procedures can be used for converting symbols to keywords and back. -@deffn procedure symbol->keyword sym +@deffn {Scheme Procedure} symbol->keyword sym Return a keyword with the same characters as in @var{sym}. @end deffn -@deffn procedure keyword->symbol kw +@deffn {Scheme Procedure} keyword->symbol kw Return a symbol with the same characters as in @var{kw}. @end deffn @@ -2803,16 +2847,19 @@ construct a keyword object programmatically, you can do so by calling (as the reader does). The dash symbol for a keyword object can be retrieved using the @code{keyword-dash-symbol} procedure. -@deffn primitive make-keyword-from-dash-symbol symbol +@deffn {Scheme Procedure} make-keyword-from-dash-symbol symbol +@deffnx {C Function} scm_make_keyword_from_dash_symbol (symbol) Make a keyword object from a @var{symbol} that starts with a dash. @end deffn -@deffn primitive keyword? obj +@deffn {Scheme Procedure} keyword? obj +@deffnx {C Function} scm_keyword_p (obj) Return @code{#t} if the argument @var{obj} is a keyword, else @code{#f}. @end deffn -@deffn primitive keyword-dash-symbol keyword +@deffn {Scheme Procedure} keyword-dash-symbol keyword +@deffnx {C Function} scm_keyword_dash_symbol (keyword) Return the dash symbol for @var{keyword}. This is the inverse of @code{make-keyword-from-dash-symbol}. @end deffn @@ -2867,14 +2914,16 @@ pair, and the pair is returned. The name @code{cons} stands for given Scheme object is a pair or not. @rnindex cons -@deffn primitive cons x y +@deffn {Scheme Procedure} cons x y +@deffnx {C Function} scm_cons (x, y) Return a newly allocated pair whose car is @var{x} and whose cdr is @var{y}. The pair is guaranteed to be different (in the sense of @code{eq?}) from every previously existing object. @end deffn @rnindex pair? -@deffn primitive pair? x +@deffn {Scheme Procedure} pair? x +@deffnx {C Function} scm_pair_p (x) Return @code{#t} if @var{x} is a pair; otherwise return @code{#f}. @end deffn @@ -2889,15 +2938,15 @@ are also predefined. @rnindex car @rnindex cdr -@deffn primitive car pair -@deffnx primitive cdr pair +@deffn {Scheme Procedure} car pair +@deffnx {Scheme Procedure} cdr pair Return the car or the cdr of @var{pair}, respectively. @end deffn -@deffn primitive caar pair -@deffnx primitive cadr pair @dots{} -@deffnx primitive cdddar pair -@deffnx primitive cddddr pair +@deffn {Scheme Procedure} caar pair +@deffnx {Scheme Procedure} cadr pair @dots{} +@deffnx {Scheme Procedure} cdddar pair +@deffnx {Scheme Procedure} cddddr pair These procedures are compositions of @code{car} and @code{cdr}, where for example @code{caddr} could be defined by @@ -2907,13 +2956,15 @@ for example @code{caddr} could be defined by @end deffn @rnindex set-car! -@deffn primitive set-car! pair value +@deffn {Scheme Procedure} set-car! pair value +@deffnx {C Function} scm_set_car_x (pair, value) Stores @var{value} in the car field of @var{pair}. The value returned by @code{set-car!} is unspecified. @end deffn @rnindex set-cdr! -@deffn primitive set-cdr! pair value +@deffn {Scheme Procedure} set-cdr! pair value +@deffnx {C Function} scm_set_cdr_x (pair, value) Stores @var{value} in the cdr field of @var{pair}. The value returned by @code{set-cdr!} is unspecified. @end deffn @@ -3006,7 +3057,8 @@ whether their input is valid, or they could do different things depending on the datatype of their arguments. @rnindex list? -@deffn primitive list? x +@deffn {Scheme Procedure} list? x +@deffnx {C Function} scm_list_p (x) Return @code{#t} iff @var{x} is a proper list, else @code{#f}. @end deffn @@ -3016,7 +3068,8 @@ somehow deals with the elements of a list until the list satisfies @code{null?}. Then, the algorithm terminates. @rnindex null? -@deffn primitive null? x +@deffn {Scheme Procedure} null? x +@deffnx {C Function} scm_null_p (x) Return @code{#t} iff @var{x} is the empty list, else @code{#f}. @end deffn @@ -3029,12 +3082,14 @@ This section describes the procedures for constructing new lists. the last pair of the list. @rnindex list -@deffn primitive list arg1 @dots{} +@deffn {Scheme Procedure} list . objs +@deffnx {C Function} scm_list (objs) Return a list containing @var{objs}, the arguments to @code{list}. @end deffn -@deffn primitive cons* arg1 arg2 @dots{} +@deffn {Scheme Procedure} cons* arg1 arg2 @dots{} +@deffnx {C Function} scm_cons_star (arg1, rest) Like @code{list}, but the last arg provides the tail of the constructed list, returning @code{(cons @var{arg1} (cons @var{arg2} (cons @dots{} @var{argn})))}. Requires at least one @@ -3043,11 +3098,12 @@ result. This function is called @code{list*} in some other Schemes and in Common LISP. @end deffn -@deffn primitive list-copy lst +@deffn {Scheme Procedure} list-copy lst +@deffnx {C Function} scm_list_copy (lst) Return a (newly-created) copy of @var{lst}. @end deffn -@deffn procedure make-list n [init] +@deffn {Scheme Procedure} make-list n [init] Create a list containing of @var{n} elements, where each element is initialized to @var{init}. @var{init} defaults to the empty list @code{()} if not given. @@ -3070,23 +3126,27 @@ These procedures are used to get some information about a list, or to retrieve one or more elements of a list. @rnindex length -@deffn primitive length lst +@deffn {Scheme Procedure} length lst +@deffnx {C Function} scm_length (lst) Return the number of elements in list @var{lst}. @end deffn -@deffn primitive last-pair lst +@deffn {Scheme Procedure} last-pair lst +@deffnx {C Function} scm_last_pair (lst) Return a pointer to the last pair in @var{lst}, signalling an error if @var{lst} is circular. @end deffn @rnindex list-ref -@deffn primitive list-ref list k +@deffn {Scheme Procedure} list-ref list k +@deffnx {C Function} scm_list_ref (list, k) Return the @var{k}th element from @var{list}. @end deffn @rnindex list-tail -@deffn primitive list-tail lst k -@deffnx primitive list-cdr-ref lst k +@deffn {Scheme Procedure} list-tail lst k +@deffnx {Scheme Procedure} list-cdr-ref lst k +@deffnx {C Function} scm_list_tail (lst, k) Return the "tail" of @var{lst} beginning with its @var{k}th element. The first element of the list is considered to be element 0. @@ -3095,7 +3155,8 @@ think of @code{list-cdr-ref} as accessing the @var{k}th cdr of the list, or returning the results of cdring @var{k} times down @var{lst}. @end deffn -@deffn primitive list-head lst k +@deffn {Scheme Procedure} list-head lst k +@deffnx {C Function} scm_list_head (lst, k) Copy the first @var{k} elements from @var{lst} into a new list, and return it. @end deffn @@ -3114,7 +3175,8 @@ pairs. This is why you should be careful when using the side-effecting variants. @rnindex append -@deffn primitive append . args +@deffn {Scheme Procedure} append . args +@deffnx {C Function} scm_append (args) Return a list consisting of the elements the lists passed as arguments. @lisp @@ -3132,23 +3194,26 @@ if the last argument is not a proper list. @end lisp @end deffn -@deffn primitive append! . lists +@deffn {Scheme Procedure} append! . lists +@deffnx {C Function} scm_append_x (lists) A destructive version of @code{append} (@pxref{Pairs and -lists,,,r5rs, The Revised^5 Report on Scheme}). The cdr field +Lists,,,r5rs, The Revised^5 Report on Scheme}). The cdr field of each list's final pair is changed to point to the head of the next list, so no consing is performed. Return a pointer to the mutated list. @end deffn @rnindex reverse -@deffn primitive reverse lst +@deffn {Scheme Procedure} reverse lst +@deffnx {C Function} scm_reverse (lst) Return a new list that contains the elements of @var{lst} but in reverse order. @end deffn @c NJFIXME explain new_tail -@deffn primitive reverse! lst [new_tail] -A destructive version of @code{reverse} (@pxref{Pairs and lists,,,r5rs, +@deffn {Scheme Procedure} reverse! lst [new_tail] +@deffnx {C Function} scm_reverse_x (lst, new_tail) +A destructive version of @code{reverse} (@pxref{Pairs and Lists,,,r5rs, The Revised^5 Report on Scheme}). The cdr of each cell in @var{lst} is modified to point to the previous list element. Return a pointer to the head of the reversed list. @@ -3167,38 +3232,46 @@ of the modified list is not lost, it is wise to save the return value of The following procedures modify an existing list, either by changing elements of the list, or by changing the list structure itself. -@deffn primitive list-set! list k val +@deffn {Scheme Procedure} list-set! list k val +@deffnx {C Function} scm_list_set_x (list, k, val) Set the @var{k}th element of @var{list} to @var{val}. @end deffn -@deffn primitive list-cdr-set! list k val +@deffn {Scheme Procedure} list-cdr-set! list k val +@deffnx {C Function} scm_list_cdr_set_x (list, k, val) Set the @var{k}th cdr of @var{list} to @var{val}. @end deffn -@deffn primitive delq item lst +@deffn {Scheme Procedure} delq item lst +@deffnx {C Function} scm_delq (item, lst) Return a newly-created copy of @var{lst} with elements @code{eq?} to @var{item} removed. This procedure mirrors @code{memq}: @code{delq} compares elements of @var{lst} against @var{item} with @code{eq?}. @end deffn -@deffn primitive delv item lst +@deffn {Scheme Procedure} delv item lst +@deffnx {C Function} scm_delv (item, lst) Return a newly-created copy of @var{lst} with elements @code{eqv?} to @var{item} removed. This procedure mirrors @code{memv}: @code{delv} compares elements of @var{lst} against @var{item} with @code{eqv?}. @end deffn -@deffn primitive delete item lst +@deffn {Scheme Procedure} delete item lst +@deffnx {C Function} scm_delete (item, lst) Return a newly-created copy of @var{lst} with elements @code{equal?} to @var{item} removed. This procedure mirrors @code{member}: @code{delete} compares elements of @var{lst} against @var{item} with @code{equal?}. @end deffn -@deffn primitive delq! item lst -@deffnx primitive delv! item lst -@deffnx primitive delete! item lst +@deffn {Scheme Procedure} delq! item lst +@deffnx {Scheme Procedure} delv! item lst +@deffnx {Scheme Procedure} delete! item lst +@deffnx {C Function} scm_delq_x (item, lst) +@deffnx {C Function} scm_delv_x (item, lst) +@deffnx {C Function} scm_delete_x (item, lst) These procedures are destructive versions of @code{delq}, @code{delv} and @code{delete}: they modify the pointers in the existing @var{lst} rather than creating a new list. Caveat evaluator: Like other @@ -3207,19 +3280,22 @@ destructive list functions, these functions cannot modify the binding of @var{lst} destructively. @end deffn -@deffn primitive delq1! item lst +@deffn {Scheme Procedure} delq1! item lst +@deffnx {C Function} scm_delq1_x (item, lst) Like @code{delq!}, but only deletes the first occurrence of @var{item} from @var{lst}. Tests for equality using @code{eq?}. See also @code{delv1!} and @code{delete1!}. @end deffn -@deffn primitive delv1! item lst +@deffn {Scheme Procedure} delv1! item lst +@deffnx {C Function} scm_delv1_x (item, lst) Like @code{delv!}, but only deletes the first occurrence of @var{item} from @var{lst}. Tests for equality using @code{eqv?}. See also @code{delq1!} and @code{delete1!}. @end deffn -@deffn primitive delete1! item lst +@deffn {Scheme Procedure} delete1! item lst +@deffnx {C Function} scm_delete1_x (item, lst) Like @code{delete!}, but only deletes the first occurrence of @var{item} from @var{lst}. Tests for equality using @code{equal?}. See also @code{delq1!} and @code{delv1!}. @@ -3237,7 +3313,8 @@ they return the sublist whose car is equal to the search object, where equality depends on the equality predicate used. @rnindex memq -@deffn primitive memq x lst +@deffn {Scheme Procedure} memq x lst +@deffnx {C Function} scm_memq (x, lst) Return the first sublist of @var{lst} whose car is @code{eq?} to @var{x} where the sublists of @var{lst} are the non-empty lists returned by @code{(list-tail @var{lst} @var{k})} for @@ -3247,7 +3324,8 @@ returned. @end deffn @rnindex memv -@deffn primitive memv x lst +@deffn {Scheme Procedure} memv x lst +@deffnx {C Function} scm_memv (x, lst) Return the first sublist of @var{lst} whose car is @code{eqv?} to @var{x} where the sublists of @var{lst} are the non-empty lists returned by @code{(list-tail @var{lst} @var{k})} for @@ -3257,7 +3335,8 @@ returned. @end deffn @rnindex member -@deffn primitive member x lst +@deffn {Scheme Procedure} member x lst +@deffnx {C Function} scm_member (x, lst) Return the first sublist of @var{lst} whose car is @code{equal?} to @var{x} where the sublists of @var{lst} are the non-empty lists returned by @code{(list-tail @var{lst} @@ -3270,19 +3349,19 @@ empty list) is returned. high level at all? Maybe these docs should be relegated to a "Guile Internals" node or something. -twp] -@deffn primitive sloppy-memq x lst +@deffn {Scheme Procedure} sloppy-memq x lst This procedure behaves like @code{memq}, but does no type or error checking. Its use is recommended only in writing Guile internals, not for high-level Scheme programs. @end deffn -@deffn primitive sloppy-memv x lst +@deffn {Scheme Procedure} sloppy-memv x lst This procedure behaves like @code{memv}, but does no type or error checking. Its use is recommended only in writing Guile internals, not for high-level Scheme programs. @end deffn -@deffn primitive sloppy-member x lst +@deffn {Scheme Procedure} sloppy-member x lst This procedure behaves like @code{member}, but does no type or error checking. Its use is recommended only in writing Guile internals, not for high-level Scheme programs. @@ -3302,8 +3381,9 @@ return value. @rnindex map @c begin (texi-doc-string "guile" "map") -@deffn primitive map proc arg1 arg2 @dots{} -@deffnx primitive map-in-order proc arg1 arg2 @dots{} +@deffn {Scheme Procedure} map proc arg1 arg2 @dots{} +@deffnx {Scheme Procedure} map-in-order proc arg1 arg2 @dots{} +@deffnx {C Function} scm_map (proc, arg1, args) Apply @var{proc} to each element of the list @var{arg1} (if only two arguments are given), or to the corresponding elements of the argument lists (if more than two arguments are given). The result(s) of the @@ -3315,7 +3395,7 @@ elements. @rnindex for-each @c begin (texi-doc-string "guile" "for-each") -@deffn primitive for-each proc arg1 arg2 @dots{} +@deffn {Scheme Procedure} for-each proc arg1 arg2 @dots{} Like @code{map}, but the procedure is always applied from left to right, and the result(s) of the procedure applications are thrown away. The return value is not specified. @@ -3362,7 +3442,8 @@ number in hexadecimal notation. @subsection Vector Predicates @rnindex vector? -@deffn primitive vector? obj +@deffn {Scheme Procedure} vector? obj +@deffnx {C Function} scm_vector_p (obj) Return @code{#t} if @var{obj} is a vector, otherwise return @code{#f}. @end deffn @@ -3370,19 +3451,21 @@ Return @code{#t} if @var{obj} is a vector, otherwise return @subsection Vector Constructors @rnindex make-vector -@deffn primitive make-vector k [fill] +@deffn {Scheme Procedure} make-vector k [fill] +@deffnx {C Function} scm_make_vector (k, fill) Return a newly allocated vector of @var{k} elements. If a second argument is given, then each position is initialized to -@var{fill}. Otherwise the initial contents of each position are +@var{fill}. Otherwise the initial contents of each position is unspecified. @end deffn @rnindex vector @rnindex list->vector -@deffn primitive vector . l -@deffnx primitive list->vector l -Return a newly allocated vector composed of the given arguments. -Analogous to @code{list}. +@deffn {Scheme Procedure} vector . l +@deffnx {Scheme Procedure} list->vector l +@deffnx {C Function} scm_vector (l) +Return a newly allocated vector composed of the +given arguments. Analogous to @code{list}. @lisp (vector 'a 'b 'c) @result{} #(a b c) @@ -3390,7 +3473,8 @@ Analogous to @code{list}. @end deffn @rnindex vector->list -@deffn primitive vector->list v +@deffn {Scheme Procedure} vector->list v +@deffnx {C Function} scm_vector_to_list (v) Return a newly allocated list composed of the elements of @var{v}. @lisp @@ -3411,7 +3495,7 @@ considered to be constant, although Guile currently does not detect this error. @rnindex vector-set! -@deffn primitive vector-set! vector k obj +@deffn {Scheme Procedure} vector-set! vector k obj Store @var{obj} in position @var{k} of @var{vector}. @var{k} must be a valid index of @var{vector}. The value returned by @samp{vector-set!} is unspecified. @@ -3423,19 +3507,20 @@ The value returned by @samp{vector-set!} is unspecified. @end deffn @rnindex vector-fill! -@deffn primitive vector-fill! v fill +@deffn {Scheme Procedure} vector-fill! v fill +@deffnx {C Function} scm_vector_fill_x (v, fill) Store @var{fill} in every position of @var{vector}. The value returned by @code{vector-fill!} is unspecified. @end deffn -@deffn primitive vector-move-left! vec1 start1 end1 vec2 start2 -Vector version of @code{substring-move-left!} (@pxref{String -Modification}). +@deffn {Scheme Procedure} vector-move-left! vec1 start1 end1 vec2 start2 +@deffnx {C Function} scm_vector_move_left_x (vec1, start1, end1, vec2, start2) +Vector version of @code{substring-move-left!}. @end deffn -@deffn primitive vector-move-right! vec1 start1 end1 vec2 start2 -Vector version of @code{substring-move-right!} (@pxref{String -Modification}). +@deffn {Scheme Procedure} vector-move-right! vec1 start1 end1 vec2 start2 +@deffnx {C Function} scm_vector_move_right_x (vec1, start1, end1, vec2, start2) +Vector version of @code{substring-move-right!}. @end deffn @subsection Vector Selection @@ -3444,12 +3529,12 @@ These procedures return information about a given vector, such as the size or what elements are contained in the vector. @rnindex vector-length -@deffn primitive vector-length vector +@deffn {Scheme Procedure} vector-length vector Return the number of elements in @var{vector} as an exact integer. @end deffn @rnindex vector-ref -@deffn primitive vector-ref vector k +@deffn {Scheme Procedure} vector-ref vector k Return the contents of position @var{k} of @var{vector}. @var{k} must be a valid index of @var{vector}. @lisp @@ -3469,7 +3554,7 @@ Return the contents of position @var{k} of @var{vector}. A @dfn{record type} is a first class object representing a user-defined data type. A @dfn{record} is an instance of a record type. -@deffn procedure record? obj +@deffn {Scheme Procedure} record? obj Return @code{#t} if @var{obj} is a record of any type and @code{#f} otherwise. @@ -3477,7 +3562,7 @@ Note that @code{record?} may be true of any Scheme value; there is no promise that records are disjoint with other Scheme types. @end deffn -@deffn procedure make-record-type type-name field-names +@deffn {Scheme Procedure} make-record-type type-name field-names Return a @dfn{record-type descriptor}, a value representing a new data type disjoint from all others. The @var{type-name} argument must be a string, but is only used for debugging purposes (such as the printed @@ -3487,7 +3572,7 @@ new type. It is an error if the list contains any duplicates. It is unspecified how record-type descriptors are represented. @end deffn -@deffn procedure record-constructor rtd [field-names] +@deffn {Scheme Procedure} record-constructor rtd [field-names] Return a procedure for constructing new members of the type represented by @var{rtd}. The returned procedure accepts exactly as many arguments as there are symbols in the given list, @var{field-names}; these are @@ -3500,14 +3585,14 @@ if the @var{field-names} argument is provided, it is an error if it contains any duplicates or any symbols not in the default list. @end deffn -@deffn procedure record-predicate rtd +@deffn {Scheme Procedure} record-predicate rtd Return a procedure for testing membership in the type represented by @var{rtd}. The returned procedure accepts exactly one argument and returns a true value if the argument is a member of the indicated record type; it returns a false value otherwise. @end deffn -@deffn procedure record-accessor rtd field-name +@deffn {Scheme Procedure} record-accessor rtd field-name Return a procedure for reading the value of a particular field of a member of the type represented by @var{rtd}. The returned procedure accepts exactly one argument which must be a record of the appropriate @@ -3517,7 +3602,7 @@ member of the list of field-names in the call to @code{make-record-type} that created the type represented by @var{rtd}. @end deffn -@deffn procedure record-modifier rtd field-name +@deffn {Scheme Procedure} record-modifier rtd field-name Return a procedure for writing the value of a particular field of a member of the type represented by @var{rtd}. The returned procedure accepts exactly two arguments: first, a record of the appropriate type, @@ -3529,7 +3614,7 @@ to @code{make-record-type} that created the type represented by @var{rtd}. @end deffn -@deffn procedure record-type-descriptor record +@deffn {Scheme Procedure} record-type-descriptor record Return a record-type descriptor representing the type of the given record. That is, for example, if the returned descriptor were passed to @code{record-predicate}, the resulting predicate would return a true @@ -3539,14 +3624,14 @@ case that the returned descriptor is the one that was passed to procedure that created the given record. @end deffn -@deffn procedure record-type-name rtd +@deffn {Scheme Procedure} record-type-name rtd Return the type-name associated with the type represented by rtd. The returned value is @code{eqv?} to the @var{type-name} argument given in the call to @code{make-record-type} that created the type represented by @var{rtd}. @end deffn -@deffn procedure record-type-fields rtd +@deffn {Scheme Procedure} record-type-fields rtd Return a list of the symbols naming the fields in members of the type represented by @var{rtd}. The returned value is @code{equal?} to the field-names argument given in the call to @code{make-record-type} that @@ -3708,7 +3793,8 @@ Structure layouts are represented by specially interned symbols whose name is a string of type and protection codes. To create a new structure layout, use this procedure: -@deffn primitive make-struct-layout fields +@deffn {Scheme Procedure} make-struct-layout fields +@deffnx {C Function} scm_make_struct_layout (fields) Return a new structure layout object. @var{fields} must be a string made up of pairs of characters @@ -3729,7 +3815,8 @@ indicate that the field is a tail-array. This section describes the basic procedures for creating and accessing structures. -@deffn primitive make-struct vtable tail_array_size . init +@deffn {Scheme Procedure} make-struct vtable tail_array_size . init +@deffnx {C Function} scm_make_struct (vtable, tail_array_size, init) Create a new structure. @var{type} must be a vtable structure (@pxref{Vtables}). @@ -3757,14 +3844,17 @@ more powerful. For more information, see the documentation for @code{make-vtable-vtable}. @end deffn -@deffn primitive struct? x +@deffn {Scheme Procedure} struct? x +@deffnx {C Function} scm_struct_p (x) Return @code{#t} iff @var{x} is a structure object, else @code{#f}. @end deffn -@deffn primitive struct-ref handle pos -@deffnx primitive struct-set! struct n value +@deffn {Scheme Procedure} struct-ref handle pos +@deffnx {Scheme Procedure} struct-set! struct n value +@deffnx {C Function} scm_struct_ref (handle, pos) +@deffnx {C Function} scm_struct_set_x (struct, n, value) Access (or modify) the @var{n}th field of @var{struct}. If the field is of type 'p', then it can be set to an arbitrary value. @@ -3786,11 +3876,13 @@ which are used only internally to libguile. The variable @code{vtable-offset-user} is bound to a field number. Vtable fields at that position or greater are user definable. -@deffn primitive struct-vtable handle +@deffn {Scheme Procedure} struct-vtable handle +@deffnx {C Function} scm_struct_vtable (handle) Return the vtable structure that describes the type of @var{struct}. @end deffn -@deffn primitive struct-vtable? x +@deffn {Scheme Procedure} struct-vtable? x +@deffnx {C Function} scm_struct_vtable_p (x) Return @code{#t} iff @var{x} is a vtable structure. @end deffn @@ -3802,7 +3894,8 @@ created by using @code{(make-struct V' ...)}. Another possibility is that @code{V} is an instance of the type it itself describes. Vtable structures of the second sort are created by this procedure: -@deffn primitive make-vtable-vtable user_fields tail_array_size . init +@deffn {Scheme Procedure} make-vtable-vtable user_fields tail_array_size . init +@deffnx {C Function} scm_make_vtable_vtable (user_fields, tail_array_size, init) Return a new, self-describing vtable structure. @var{user-fields} is a string describing user defined fields of the @@ -3861,15 +3954,18 @@ ball @result{} #<a green ball owned by Nisse> @end lisp @end deffn -@deffn primitive struct-vtable-name vtable +@deffn {Scheme Procedure} struct-vtable-name vtable +@deffnx {C Function} scm_struct_vtable_name (vtable) Return the name of the vtable @var{vtable}. @end deffn -@deffn primitive set-struct-vtable-name! vtable name +@deffn {Scheme Procedure} set-struct-vtable-name! vtable name +@deffnx {C Function} scm_set_struct_vtable_name_x (vtable, name) Set the name of the vtable @var{vtable} to @var{name}. @end deffn -@deffn primitive struct-vtable-tag handle +@deffn {Scheme Procedure} struct-vtable-tag handle +@deffnx {C Function} scm_struct_vtable_tag (handle) Return the vtable tag of the structure @var{handle}. @end deffn @@ -3928,13 +4024,14 @@ a vector: The following procedures can be used with conventional arrays (or vectors). -@deffn primitive array? v [prot] +@deffn {Scheme Procedure} array? v [prot] +@deffnx {C Function} scm_array_p (v, prot) Return @code{#t} if the @var{obj} is an array, and @code{#f} if not. The @var{prototype} argument is used with uniform arrays and is described elsewhere. @end deffn -@deffn procedure make-array initial-value bound1 bound2 @dots{} +@deffn {Scheme Procedure} make-array initial-value bound1 bound2 @dots{} Create and return an array that has as many dimensions as there are @var{bound}s and fill it with @var{initial-value}. Each @var{bound} may be a positive non-zero integer @var{N}, in which case the index for @@ -3947,25 +4044,29 @@ same number (however, @var{lower} cannot be greater than @var{upper}). @c array-ref's type is `compiled-closure'. There's some weird stuff @c going on in array.c, too. Let's call it a primitive. -twp -@deffn primitive uniform-vector-ref v args -@deffnx primitive array-ref v . args +@deffn {Scheme Procedure} uniform-vector-ref v args +@deffnx {Scheme Procedure} array-ref v . args +@deffnx {C Function} scm_uniform_vector_ref (v, args) Return the element at the @code{(index1, index2)} element in @var{array}. @end deffn -@deffn primitive array-in-bounds? v . args +@deffn {Scheme Procedure} array-in-bounds? v . args +@deffnx {C Function} scm_array_in_bounds_p (v, args) Return @code{#t} if its arguments would be acceptable to @code{array-ref}. @end deffn @c fixme: why do these sigs differ? -ttn 2001/07/19 01:14:12 -@deffn primitive array-set! v obj . args -@deffnx primitive uniform-array-set1! v obj args +@deffn {Scheme Procedure} array-set! v obj . args +@deffnx {Scheme Procedure} uniform-array-set1! v obj args +@deffnx {C Function} scm_array_set_x (v, obj, args) Set the element at the @code{(index1, index2)} element in @var{array} to @var{new-value}. The value returned by array-set! is unspecified. @end deffn -@deffn primitive make-shared-array oldra mapfunc . dims +@deffn {Scheme Procedure} make-shared-array oldra mapfunc . dims +@deffnx {C Function} scm_make_shared_array (oldra, mapfunc, dims) @code{make-shared-array} can be used to create shared subarrays of other arrays. The @var{mapper} is a function that translates coordinates in the new array into coordinates in the old array. A @var{mapper} must be @@ -3983,19 +4084,23 @@ it can be otherwise arbitrary. A simple example: @end lisp @end deffn -@deffn primitive shared-array-increments ra +@deffn {Scheme Procedure} shared-array-increments ra +@deffnx {C Function} scm_shared_array_increments (ra) For each dimension, return the distance between elements in the root vector. @end deffn -@deffn primitive shared-array-offset ra +@deffn {Scheme Procedure} shared-array-offset ra +@deffnx {C Function} scm_shared_array_offset (ra) Return the root vector index of the first element in the array. @end deffn -@deffn primitive shared-array-root ra +@deffn {Scheme Procedure} shared-array-root ra +@deffnx {C Function} scm_shared_array_root (ra) Return the root vector of a shared array. @end deffn -@deffn primitive transpose-array ra . args +@deffn {Scheme Procedure} transpose-array ra . args +@deffnx {C Function} scm_transpose_array (ra, args) Return an array sharing contents with @var{array}, but with dimensions arranged in a different order. There must be one @var{dim} argument for each dimension of @var{array}. @@ -4017,7 +4122,8 @@ have smaller rank than @var{array}. @end lisp @end deffn -@deffn primitive enclose-array ra . axes +@deffn {Scheme Procedure} enclose-array ra . axes +@deffnx {C Function} scm_enclose_array (ra, axes) @var{dim0}, @var{dim1} @dots{} should be nonnegative integers less than the rank of @var{array}. @var{enclose-array} returns an array resembling an array of shared arrays. The dimensions of each shared @@ -4041,14 +4147,15 @@ examples: @end lisp @end deffn -@deffn procedure array-shape array +@deffn {Scheme Procedure} array-shape array Return a list of inclusive bounds of integers. @example (array-shape (make-array 'foo '(-1 3) 5)) @result{} ((-1 3) (0 4)) @end example @end deffn -@deffn primitive array-dimensions ra +@deffn {Scheme Procedure} array-dimensions ra +@deffnx {C Function} scm_array_dimensions (ra) @code{Array-dimensions} is similar to @code{array-shape} but replaces elements with a @code{0} minimum with one greater than the maximum. So: @lisp @@ -4056,31 +4163,35 @@ elements with a @code{0} minimum with one greater than the maximum. So: @end lisp @end deffn -@deffn primitive array-rank ra +@deffn {Scheme Procedure} array-rank ra +@deffnx {C Function} scm_array_rank (ra) Return the number of dimensions of @var{obj}. If @var{obj} is not an array, @code{0} is returned. @end deffn -@deffn primitive array->list v +@deffn {Scheme Procedure} array->list v +@deffnx {C Function} scm_t_arrayo_list (v) Return a list consisting of all the elements, in order, of @var{array}. @end deffn -@deffn primitive array-copy! src dst -@deffnx primitive array-copy-in-order! src dst +@deffn {Scheme Procedure} array-copy! src dst +@deffnx {Scheme Procedure} array-copy-in-order! src dst +@deffnx {C Function} scm_array_copy_x (src, dst) Copy every element from vector or array @var{source} to the corresponding element of @var{destination}. @var{destination} must have the same rank as @var{source}, and be at least as large in each dimension. The order is unspecified. @end deffn -@deffn primitive array-fill! ra fill +@deffn {Scheme Procedure} array-fill! ra fill +@deffnx {C Function} scm_array_fill_x (ra, fill) Store @var{fill} in every element of @var{array}. The value returned is unspecified. @end deffn @c begin (texi-doc-string "guile" "array-equal?") -@deffn primitive array-equal? ra0 ra1 +@deffn {Scheme Procedure} array-equal? ra0 ra1 Return @code{#t} iff all arguments are arrays with the same shape, the same type, and have corresponding elements which are either @code{equal?} or @code{array-equal?}. This function differs from @@ -4088,8 +4199,8 @@ same type, and have corresponding elements which are either @var{array-equal?} but not @var{equal?} to a vector or uniform vector. @end deffn -@deffn primitive array-contents ra [strict] -@deffnx primitive array-contents array strict +@deffn {Scheme Procedure} array-contents array [strict] +@deffnx {C Function} scm_array_contents (array, strict) If @var{array} may be @dfn{unrolled} into a one dimensional shared array without changing their order (last subscript changing fastest), then @code{array-contents} returns that shared array, otherwise it returns @@ -4105,8 +4216,9 @@ memory. @node Array Mapping @subsection Array Mapping -@deffn primitive array-map! ra0 proc . lra -@deffnx primitive array-map-in-order! ra0 proc . lra +@deffn {Scheme Procedure} array-map! ra0 proc . lra +@deffnx {Scheme Procedure} array-map-in-order! ra0 proc . lra +@deffnx {C Function} scm_array_map_x (ra0, proc, lra) @var{array1}, @dots{} must have the same number of dimensions as @var{array0} and have a range for each index which includes the range for the corresponding index in @var{array0}. @var{proc} is applied to @@ -4115,12 +4227,14 @@ as the corresponding element in @var{array0}. The value returned is unspecified. The order of application is unspecified. @end deffn -@deffn primitive array-for-each proc ra0 . lra +@deffn {Scheme Procedure} array-for-each proc ra0 . lra +@deffnx {C Function} scm_array_for_each (proc, ra0, lra) Apply @var{proc} to each tuple of elements of @var{array0} @dots{} in row-major order. The value returned is unspecified. @end deffn -@deffn primitive array-index-map! ra proc +@deffn {Scheme Procedure} array-index-map! ra proc +@deffnx {C Function} scm_array_index_map_x (ra, proc) Apply @var{proc} to the indices of each element of @var{array} in turn, storing the result in the corresponding element. The value returned and the order of application are unspecified. @@ -4198,44 +4312,48 @@ except that a single character from the above table is put between @code{#} and @code{(}. For example, a uniform vector of signed long integers is displayed in the form @code{'#e(3 5 9)}. -@deffn primitive array? v [prot] +@deffn {Scheme Procedure} array? v [prot] Return @code{#t} if the @var{obj} is an array, and @code{#f} if not. The @var{prototype} argument is used with uniform arrays and is described elsewhere. @end deffn -@deffn procedure make-uniform-array prototype bound1 bound2 @dots{} +@deffn {Scheme Procedure} make-uniform-array prototype bound1 bound2 @dots{} Create and return a uniform array of type corresponding to @var{prototype} that has as many dimensions as there are @var{bound}s and fill it with @var{prototype}. @end deffn -@deffn primitive array-prototype ra +@deffn {Scheme Procedure} array-prototype ra +@deffnx {C Function} scm_array_prototype (ra) Return an object that would produce an array of the same type as @var{array}, if used as the @var{prototype} for @code{make-uniform-array}. @end deffn -@deffn primitive list->uniform-array ndim prot lst -@deffnx procedure list->uniform-vector prot lst +@deffn {Scheme Procedure} list->uniform-array ndim prot lst +@deffnx {Scheme Procedure} list->uniform-vector prot lst +@deffnx {C Function} scm_list_to_uniform_array (ndim, prot, lst) Return a uniform array of the type indicated by prototype @var{prot} with elements the same as those of @var{lst}. Elements must be of the appropriate type, no coercions are done. @end deffn -@deffn primitive uniform-vector-fill! uve fill +@deffn {Scheme Procedure} uniform-vector-fill! uve fill Store @var{fill} in every element of @var{uve}. The value returned is unspecified. @end deffn -@deffn primitive uniform-vector-length v +@deffn {Scheme Procedure} uniform-vector-length v +@deffnx {C Function} scm_uniform_vector_length (v) Return the number of elements in @var{uve}. @end deffn -@deffn primitive dimensions->uniform-array dims prot [fill] -@deffnx primitive make-uniform-vector length prototype [fill] +@deffn {Scheme Procedure} dimensions->uniform-array dims prot [fill] +@deffnx {Scheme Procedure} make-uniform-vector length prototype [fill] +@deffnx {C Function} scm_dimensions_to_uniform_array (dims, prot, fill) Create and return a uniform array or vector of type corresponding to @var{prototype} with dimensions @var{dims} or length @var{length}. If @var{fill} is supplied, it's used to @@ -4244,12 +4362,13 @@ fill the array, otherwise @var{prototype} is used. @c Another compiled-closure. -twp -@deffn primitive uniform-array-read! ra [port_or_fd [start [end]]] -@deffnx primitive uniform-vector-read! uve [port-or-fdes] [start] [end] +@deffn {Scheme Procedure} uniform-array-read! ra [port_or_fd [start [end]]] +@deffnx {Scheme Procedure} uniform-vector-read! uve [port-or-fdes] [start] [end] +@deffnx {C Function} scm_uniform_array_read_x (ra, port_or_fd, start, end) Attempt to read all elements of @var{ura}, in lexicographic order, as binary objects from @var{port-or-fdes}. -If an end of file is encountered during -uniform-array-read! the objects up to that point only are put into @var{ura} +If an end of file is encountered, +the objects up to that point are put into @var{ura} (starting at the beginning) and the remainder of the array is unchanged. @@ -4262,8 +4381,9 @@ leaving the remainder of the vector unchanged. returned by @code{(current-input-port)}. @end deffn -@deffn primitive uniform-array-write v [port_or_fd [start [end]]] -@deffnx primitive uniform-vector-write uve [port-or-fdes] [start] [end] +@deffn {Scheme Procedure} uniform-array-write v [port_or_fd [start [end]]] +@deffnx {Scheme Procedure} uniform-vector-write uve [port-or-fdes] [start] [end] +@deffnx {C Function} scm_uniform_array_write (v, port_or_fd, start, end) Writes all elements of @var{ura} as binary objects to @var{port-or-fdes}. @@ -4296,22 +4416,26 @@ They are displayed as a sequence of @code{0}s and #*101 @end example -@deffn primitive bit-count b bitvector +@deffn {Scheme Procedure} bit-count b bitvector +@deffnx {C Function} scm_bit_count (b, bitvector) Return the number of occurrences of the boolean @var{b} in @var{bitvector}. @end deffn -@deffn primitive bit-position item v k +@deffn {Scheme Procedure} bit-position item v k +@deffnx {C Function} scm_bit_position (item, v, k) Return the minimum index of an occurrence of @var{bool} in @var{bv} which is at least @var{k}. If no @var{bool} occurs within the specified range @code{#f} is returned. @end deffn -@deffn primitive bit-invert! v +@deffn {Scheme Procedure} bit-invert! v +@deffnx {C Function} scm_bit_invert_x (v) Modify @var{bv} by replacing each element with its negation. @end deffn -@deffn primitive bit-set*! v kv obj +@deffn {Scheme Procedure} bit-set*! v kv obj +@deffnx {C Function} scm_bit_set_star_x (v, kv, obj) If uve is a bit-vector @var{bv} and uve must be of the same length. If @var{bool} is @code{#t}, uve is OR'ed into @var{bv}; If @var{bool} is @code{#f}, the inversion of uve is @@ -4323,7 +4447,8 @@ of @var{bv} corresponding to the indexes in uve are set to @var{bool}. The return value is unspecified. @end deffn -@deffn primitive bit-count* v kv obj +@deffn {Scheme Procedure} bit-count* v kv obj +@deffnx {C Function} scm_bit_count_star (v, kv, obj) Return @lisp (bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t). @@ -4552,16 +4677,20 @@ independent from the list that results from modification by use @code{list-copy} to copy the old association list before modifying it. -@deffn primitive acons key value alist +@deffn {Scheme Procedure} acons key value alist +@deffnx {C Function} scm_acons (key, value, alist) Add a new key-value pair to @var{alist}. A new pair is created whose car is @var{key} and whose cdr is @var{value}, and the pair is consed onto @var{alist}, and the new list is returned. This function is @emph{not} destructive; @var{alist} is not modified. @end deffn -@deffn primitive assq-set! alist key val -@deffnx primitive assv-set! alist key value -@deffnx primitive assoc-set! alist key value +@deffn {Scheme Procedure} assq-set! alist key val +@deffnx {Scheme Procedure} assv-set! alist key value +@deffnx {Scheme Procedure} assoc-set! alist key value +@deffnx {C Function} scm_assq_set_x (alist, key, val) +@deffnx {C Function} scm_assv_set_x (alist, key, val) +@deffnx {C Function} scm_assoc_set_x (alist, key, val) Reassociate @var{key} in @var{alist} with @var{value}: find any existing @var{alist} entry for @var{key} and associate it with the new @var{value}. If @var{alist} does not contain an entry for @var{key}, @@ -4584,9 +4713,12 @@ arguments and return the entry for that key if an entry exists, or where an entry exists, these procedures return the complete entry, that is @code{(KEY . VALUE)}, not just the value. -@deffn primitive assq key alist -@deffnx primitive assv key alist -@deffnx primitive assoc key alist +@deffn {Scheme Procedure} assq key alist +@deffnx {Scheme Procedure} assv key alist +@deffnx {Scheme Procedure} assoc key alist +@deffnx {C Function} scm_assq (key, alist) +@deffnx {C Function} scm_assv (key, alist) +@deffnx {C Function} scm_assoc (key, alist) Fetch the entry in @var{alist} that is associated with @var{key}. To decide whether the argument @var{key} matches a particular entry in @var{alist}, @code{assq} compares keys with @code{eq?}, @code{assv} @@ -4608,9 +4740,12 @@ Consequently, @code{assq-ref} and friends should only be used where it is known that an entry exists, or where the ambiguity doesn't matter for some other reason. -@deffn primitive assq-ref alist key -@deffnx primitive assv-ref alist key -@deffnx primitive assoc-ref alist key +@deffn {Scheme Procedure} assq-ref alist key +@deffnx {Scheme Procedure} assv-ref alist key +@deffnx {Scheme Procedure} assoc-ref alist key +@deffnx {C Function} scm_assq_ref (alist, key) +@deffnx {C Function} scm_assv_ref (alist, key) +@deffnx {C Function} scm_assoc_ref (alist, key) Like @code{assq}, @code{assv} and @code{assoc}, except that only the value associated with @var{key} in @var{alist} is returned. These functions are equivalent to @@ -4681,9 +4816,12 @@ two distinct entries to @code{address-list}. When compared using after removing the first matching entry that it finds, and so one of the "mary" entries is left in place. -@deffn primitive assq-remove! alist key -@deffnx primitive assv-remove! alist key -@deffnx primitive assoc-remove! alist key +@deffn {Scheme Procedure} assq-remove! alist key +@deffnx {Scheme Procedure} assv-remove! alist key +@deffnx {Scheme Procedure} assoc-remove! alist key +@deffnx {C Function} scm_assq_remove_x (alist, key) +@deffnx {C Function} scm_assv_remove_x (alist, key) +@deffnx {C Function} scm_assoc_remove_x (alist, key) Delete the first entry in @var{alist} associated with @var{key}, and return the resulting alist. @end deffn @@ -4733,17 +4871,20 @@ it is much safer to use the non-@code{sloppy-} procedures, because they help to highlight coding and data errors that the @code{sloppy-} versions would silently cover up. -@deffn primitive sloppy-assq key alist +@deffn {Scheme Procedure} sloppy-assq key alist +@deffnx {C Function} scm_sloppy_assq (key, alist) Behaves like @code{assq} but does not do any error checking. Recommended only for use in Guile internals. @end deffn -@deffn primitive sloppy-assv key alist +@deffn {Scheme Procedure} sloppy-assv key alist +@deffnx {C Function} scm_sloppy_assv (key, alist) Behaves like @code{assv} but does not do any error checking. Recommended only for use in Guile internals. @end deffn -@deffn primitive sloppy-assoc key alist +@deffn {Scheme Procedure} sloppy-assoc key alist +@deffnx {C Function} scm_sloppy_assoc (key, alist) Behaves like @code{assoc} but does not do any error checking. Recommended only for use in Guile internals. @end deffn @@ -4895,7 +5036,7 @@ In each of the functions that follow, the @var{table} argument must be a vector. The @var{key} and @var{value} arguments may be any Scheme object. -@deffn procedure make-hash-table size +@deffn {Scheme Procedure} make-hash-table size Create a new hash table of @var{size} slots. Note that the number of slots does not limit the size of the table, it just tells how large the underlying vector will be. The @var{size} should be similar to @@ -4904,54 +5045,63 @@ they need not match. For good performance, it might be a good idea to use a prime number as the @var{size}. @end deffn -@deffn primitive hashq-ref table key [dflt] +@deffn {Scheme Procedure} hashq-ref table key [dflt] +@deffnx {C Function} scm_hashq_ref (table, key, dflt) Look up @var{key} in the hash table @var{table}, and return the value (if any) associated with it. If @var{key} is not found, return @var{default} (or @code{#f} if no @var{default} argument is supplied). Uses @code{eq?} for equality testing. @end deffn -@deffn primitive hashv-ref table key [dflt] +@deffn {Scheme Procedure} hashv-ref table key [dflt] +@deffnx {C Function} scm_hashv_ref (table, key, dflt) Look up @var{key} in the hash table @var{table}, and return the value (if any) associated with it. If @var{key} is not found, return @var{default} (or @code{#f} if no @var{default} argument is supplied). Uses @code{eqv?} for equality testing. @end deffn -@deffn primitive hash-ref table key [dflt] +@deffn {Scheme Procedure} hash-ref table key [dflt] +@deffnx {C Function} scm_hash_ref (table, key, dflt) Look up @var{key} in the hash table @var{table}, and return the value (if any) associated with it. If @var{key} is not found, return @var{default} (or @code{#f} if no @var{default} argument is supplied). Uses @code{equal?} for equality testing. @end deffn -@deffn primitive hashq-set! table key val +@deffn {Scheme Procedure} hashq-set! table key val +@deffnx {C Function} scm_hashq_set_x (table, key, val) Find the entry in @var{table} associated with @var{key}, and store @var{value} there. Uses @code{eq?} for equality testing. @end deffn -@deffn primitive hashv-set! table key val +@deffn {Scheme Procedure} hashv-set! table key val +@deffnx {C Function} scm_hashv_set_x (table, key, val) Find the entry in @var{table} associated with @var{key}, and store @var{value} there. Uses @code{eqv?} for equality testing. @end deffn -@deffn primitive hash-set! table key val +@deffn {Scheme Procedure} hash-set! table key val +@deffnx {C Function} scm_hash_set_x (table, key, val) Find the entry in @var{table} associated with @var{key}, and store @var{value} there. Uses @code{equal?} for equality testing. @end deffn -@deffn primitive hashq-remove! table key +@deffn {Scheme Procedure} hashq-remove! table key +@deffnx {C Function} scm_hashq_remove_x (table, key) Remove @var{key} (and any value associated with it) from @var{table}. Uses @code{eq?} for equality tests. @end deffn -@deffn primitive hashv-remove! table key +@deffn {Scheme Procedure} hashv-remove! table key +@deffnx {C Function} scm_hashv_remove_x (table, key) Remove @var{key} (and any value associated with it) from @var{table}. Uses @code{eqv?} for equality tests. @end deffn -@deffn primitive hash-remove! table key +@deffn {Scheme Procedure} hash-remove! table key +@deffnx {C Function} scm_hash_remove_x (table, key) Remove @var{key} (and any value associated with it) from @var{table}. Uses @code{equal?} for equality tests. @end deffn @@ -4971,7 +5121,8 @@ use comfortably. If you are interested in learning more, see an introductory textbook on data structures or algorithms for an explanation of how hash tables are implemented. -@deffn primitive hashq key size +@deffn {Scheme Procedure} hashq key size +@deffnx {C Function} scm_hashq (key, size) Determine a hash value for @var{key} that is suitable for lookups in a hashtable of size @var{size}, where @code{eq?} is used as the equality predicate. The function returns an @@ -4984,7 +5135,8 @@ in between. This can happen, for example with symbols: different values, since @code{foo} will be garbage collected. @end deffn -@deffn primitive hashv key size +@deffn {Scheme Procedure} hashv key size +@deffnx {C Function} scm_hashv (key, size) Determine a hash value for @var{key} that is suitable for lookups in a hashtable of size @var{size}, where @code{eqv?} is used as the equality predicate. The function returns an @@ -4997,14 +5149,16 @@ in between. This can happen, for example with symbols: different values, since @code{foo} will be garbage collected. @end deffn -@deffn primitive hash key size +@deffn {Scheme Procedure} hash key size +@deffnx {C Function} scm_hash (key, size) Determine a hash value for @var{key} that is suitable for lookups in a hashtable of size @var{size}, where @code{equal?} is used as the equality predicate. The function returns an integer in the range 0 to @var{size} - 1. @end deffn -@deffn primitive hashx-ref hash assoc table key [dflt] +@deffn {Scheme Procedure} hashx-ref hash assoc table key [dflt] +@deffnx {C Function} scm_hashx_ref (hash, assoc, table, key, dflt) This behaves the same way as the corresponding @code{ref} function, but uses @var{hash} as a hash function and @var{assoc} to compare keys. @code{hash} must be a function @@ -5016,7 +5170,8 @@ By way of illustration, @code{hashq-ref table key} is equivalent to @code{hashx-ref hashq assq table key}. @end deffn -@deffn primitive hashx-set! hash assoc table key val +@deffn {Scheme Procedure} hashx-set! hash assoc table key val +@deffnx {C Function} scm_hashx_set_x (hash, assoc, table, key, val) This behaves the same way as the corresponding @code{set!} function, but uses @var{hash} as a hash function and @var{assoc} to compare keys. @code{hash} must be a function @@ -5028,28 +5183,32 @@ that takes two arguments, a key to be hashed and a table size. equivalent to @code{hashx-set! hashq assq table key}. @end deffn -@deffn primitive hashq-get-handle table key +@deffn {Scheme Procedure} hashq-get-handle table key +@deffnx {C Function} scm_hashq_get_handle (table, key) This procedure returns the @code{(key . value)} pair from the hash table @var{table}. If @var{table} does not hold an associated value for @var{key}, @code{#f} is returned. Uses @code{eq?} for equality testing. @end deffn -@deffn primitive hashv-get-handle table key +@deffn {Scheme Procedure} hashv-get-handle table key +@deffnx {C Function} scm_hashv_get_handle (table, key) This procedure returns the @code{(key . value)} pair from the hash table @var{table}. If @var{table} does not hold an associated value for @var{key}, @code{#f} is returned. Uses @code{eqv?} for equality testing. @end deffn -@deffn primitive hash-get-handle table key +@deffn {Scheme Procedure} hash-get-handle table key +@deffnx {C Function} scm_hash_get_handle (table, key) This procedure returns the @code{(key . value)} pair from the hash table @var{table}. If @var{table} does not hold an associated value for @var{key}, @code{#f} is returned. Uses @code{equal?} for equality testing. @end deffn -@deffn primitive hashx-get-handle hash assoc table key +@deffn {Scheme Procedure} hashx-get-handle hash assoc table key +@deffnx {C Function} scm_hashx_get_handle (hash, assoc, table, key) This behaves the same way as the corresponding @code{-get-handle} function, but uses @var{hash} as a hash function and @var{assoc} to compare keys. @code{hash} must be @@ -5058,25 +5217,29 @@ table size. @code{assoc} must be an associator function, like @code{assoc}, @code{assq} or @code{assv}. @end deffn -@deffn primitive hashq-create-handle! table key init +@deffn {Scheme Procedure} hashq-create-handle! table key init +@deffnx {C Function} scm_hashq_create_handle_x (table, key, init) This function looks up @var{key} in @var{table} and returns its handle. If @var{key} is not already present, a new handle is created which associates @var{key} with @var{init}. @end deffn -@deffn primitive hashv-create-handle! table key init +@deffn {Scheme Procedure} hashv-create-handle! table key init +@deffnx {C Function} scm_hashv_create_handle_x (table, key, init) This function looks up @var{key} in @var{table} and returns its handle. If @var{key} is not already present, a new handle is created which associates @var{key} with @var{init}. @end deffn -@deffn primitive hash-create-handle! table key init +@deffn {Scheme Procedure} hash-create-handle! table key init +@deffnx {C Function} scm_hash_create_handle_x (table, key, init) This function looks up @var{key} in @var{table} and returns its handle. If @var{key} is not already present, a new handle is created which associates @var{key} with @var{init}. @end deffn -@deffn primitive hashx-create-handle! hash assoc table key init +@deffn {Scheme Procedure} hashx-create-handle! hash assoc table key init +@deffnx {C Function} scm_hashx_create_handle_x (hash, assoc, table, key, init) This behaves the same way as the corresponding @code{-create-handle} function, but uses @var{hash} as a hash function and @var{assoc} to compare keys. @code{hash} must be @@ -5085,7 +5248,8 @@ table size. @code{assoc} must be an associator function, like @code{assoc}, @code{assq} or @code{assv}. @end deffn -@deffn primitive hash-fold proc init table +@deffn {Scheme Procedure} hash-fold proc init table +@deffnx {C Function} scm_hash_fold (proc, init, table) An iterator over hash-table elements. Accumulates and returns a result by applying PROC successively. The arguments to PROC are "(key value prior-result)" where key @@ -5188,45 +5352,53 @@ are always called from first to last when they are invoked via When calling @code{hook->list}, the procedures in the resulting list are in the same order as they would have been called by @code{run-hook}. -@deffn primitive make-hook [n_args] +@deffn {Scheme Procedure} make-hook [n_args] +@deffnx {C Function} scm_make_hook (n_args) Create a hook for storing procedure of arity @var{n_args}. @var{n_args} defaults to zero. The returned value is a hook object to be used with the other hook procedures. @end deffn -@deffn primitive hook? x +@deffn {Scheme Procedure} hook? x +@deffnx {C Function} scm_hook_p (x) Return @code{#t} if @var{x} is a hook, @code{#f} otherwise. @end deffn -@deffn primitive hook-empty? hook +@deffn {Scheme Procedure} hook-empty? hook +@deffnx {C Function} scm_hook_empty_p (hook) Return @code{#t} if @var{hook} is an empty hook, @code{#f} otherwise. @end deffn -@deffn primitive add-hook! hook proc [append_p] +@deffn {Scheme Procedure} add-hook! hook proc [append_p] +@deffnx {C Function} scm_add_hook_x (hook, proc, append_p) Add the procedure @var{proc} to the hook @var{hook}. The procedure is added to the end if @var{append_p} is true, otherwise it is added to the front. The return value of this procedure is not specified. @end deffn -@deffn primitive remove-hook! hook proc +@deffn {Scheme Procedure} remove-hook! hook proc +@deffnx {C Function} scm_remove_hook_x (hook, proc) Remove the procedure @var{proc} from the hook @var{hook}. The return value of this procedure is not specified. @end deffn -@deffn primitive reset-hook! hook +@deffn {Scheme Procedure} reset-hook! hook +@deffnx {C Function} scm_reset_hook_x (hook) Remove all procedures from the hook @var{hook}. The return value of this procedure is not specified. @end deffn -@deffn primitive run-hook hook . args +@deffn {Scheme Procedure} run-hook hook . args +@deffnx {C Function} scm_run_hook (hook, args) Apply all procedures from the hook @var{hook} to the arguments @var{args}. The order of the procedure application is first to last. The return value of this procedure is not specified. @end deffn -@deffn primitive hook->list hook +@deffn {Scheme Procedure} hook->list hook +@deffnx {C Function} scm_hook_to_list (hook) Convert the procedure list of @var{hook} to a list. @end deffn diff --git a/doc/ref/scheme-debug.texi b/doc/ref/scheme-debug.texi index 170d7e382..c6a92130e 100644 --- a/doc/ref/scheme-debug.texi +++ b/doc/ref/scheme-debug.texi @@ -6,7 +6,8 @@ from the appendix describing the debugger UI. The intro should have a pointer to the UI appendix. -@deffn primitive display-error stack port subr message args rest +@deffn {Scheme Procedure} display-error stack port subr message args rest +@deffnx {C Function} scm_display_error (stack, port, subr, message, args, rest) Display an error message to the output port @var{port}. @var{stack} is the saved stack for the error, @var{subr} is the name of the procedure in which the error occured and @@ -16,13 +17,15 @@ the list @var{args} accordingly. @var{rest} is currently ignored. @end deffn -@deffn primitive display-application frame [port [indent]] +@deffn {Scheme Procedure} display-application frame [port [indent]] +@deffnx {C Function} scm_display_application (frame, port, indent) Display a procedure application @var{frame} to the output port @var{port}. @var{indent} specifies the indentation of the output. @end deffn -@deffn primitive display-backtrace stack port [first [depth]] +@deffn {Scheme Procedure} display-backtrace stack port [first [depth]] +@deffnx {C Function} scm_display_backtrace (stack, port, first, depth) Display a backtrace to the output port @var{port}. @var{stack} is the stack to take the backtrace from, @var{first} specifies where in the stack to start and @var{depth} how much frames @@ -30,12 +33,13 @@ to display. Both @var{first} and @var{depth} can be @code{#f}, which means that default values will be used. @end deffn -@deffn primitive backtrace +@deffn {Scheme Procedure} backtrace +@deffnx {C Function} scm_backtrace () Display a backtrace of the stack saved by the last error to the current output port. @end deffn -@deffn primitive malloc-stats +@deffn {Scheme Procedure} malloc-stats Return an alist ((@var{what} . @var{n}) ...) describing number of malloced objects. @var{what} is the second argument to @code{scm_must_malloc}, @@ -43,98 +47,120 @@ of malloced objects. allocated. @end deffn -@deffn primitive debug-options-interface [setting] +@deffn {Scheme Procedure} debug-options-interface [setting] +@deffnx {C Function} scm_debug_options (setting) Option interface for the debug options. Instead of using this procedure directly, use the procedures @code{debug-enable}, @code{debug-disable}, @code{debug-set!} and @var{debug-options}. @end deffn -@deffn primitive with-traps thunk +@deffn {Scheme Procedure} with-traps thunk +@deffnx {C Function} scm_with_traps (thunk) Call @var{thunk} with traps enabled. @end deffn -@deffn primitive memoized? obj +@deffn {Scheme Procedure} memoized? obj +@deffnx {C Function} scm_memoized_p (obj) Return @code{#t} if @var{obj} is memoized. @end deffn -@deffn primitive unmemoize m +@deffn {Scheme Procedure} unmemoize m +@deffnx {C Function} scm_unmemoize (m) Unmemoize the memoized expression @var{m}, @end deffn -@deffn primitive memoized-environment m +@deffn {Scheme Procedure} memoized-environment m +@deffnx {C Function} scm_memoized_environment (m) Return the environment of the memoized expression @var{m}. @end deffn -@deffn primitive procedure-name proc +@deffn {Scheme Procedure} procedure-name proc +@deffnx {C Function} scm_procedure_name (proc) Return the name of the procedure @var{proc} @end deffn -@deffn primitive procedure-source proc +@deffn {Scheme Procedure} procedure-source proc +@deffnx {C Function} scm_procedure_source (proc) Return the source of the procedure @var{proc}. @end deffn -@deffn primitive procedure-environment proc +@deffn {Scheme Procedure} procedure-environment proc +@deffnx {C Function} scm_procedure_environment (proc) Return the environment of the procedure @var{proc}. @end deffn -@deffn primitive debug-object? obj +@deffn {Scheme Procedure} debug-object? obj +@deffnx {C Function} scm_debug_object_p (obj) Return @code{#t} if @var{obj} is a debug object. @end deffn -@deffn primitive frame-arguments frame +@deffn {Scheme Procedure} frame-arguments frame +@deffnx {C Function} scm_frame_arguments (frame) Return the arguments of @var{frame}. @end deffn -@deffn primitive frame-evaluating-args? frame +@deffn {Scheme Procedure} frame-evaluating-args? frame +@deffnx {C Function} scm_frame_evaluating_args_p (frame) Return @code{#t} if @var{frame} contains evaluated arguments. @end deffn -@deffn primitive frame-next frame +@deffn {Scheme Procedure} frame-next frame +@deffnx {C Function} scm_frame_next (frame) Return the next frame of @var{frame}, or @code{#f} if @var{frame} is the last frame in its stack. @end deffn -@deffn primitive frame-number frame +@deffn {Scheme Procedure} frame-number frame +@deffnx {C Function} scm_frame_number (frame) Return the frame number of @var{frame}. @end deffn -@deffn primitive frame-overflow? frame +@deffn {Scheme Procedure} frame-overflow? frame +@deffnx {C Function} scm_frame_overflow_p (frame) Return @code{#t} if @var{frame} is an overflow frame. @end deffn -@deffn primitive frame-previous frame +@deffn {Scheme Procedure} frame-previous frame +@deffnx {C Function} scm_frame_previous (frame) Return the previous frame of @var{frame}, or @code{#f} if @var{frame} is the first frame in its stack. @end deffn -@deffn primitive frame-procedure frame +@deffn {Scheme Procedure} frame-procedure frame +@deffnx {C Function} scm_frame_procedure (frame) Return the procedure for @var{frame}, or @code{#f} if no procedure is associated with @var{frame}. @end deffn -@deffn primitive frame-procedure? frame +@deffn {Scheme Procedure} frame-procedure? frame +@deffnx {C Function} scm_frame_procedure_p (frame) Return @code{#t} if a procedure is associated with @var{frame}. @end deffn -@deffn primitive frame-real? frame +@deffn {Scheme Procedure} frame-real? frame +@deffnx {C Function} scm_frame_real_p (frame) Return @code{#t} if @var{frame} is a real frame. @end deffn -@deffn primitive frame-source frame +@deffn {Scheme Procedure} frame-source frame +@deffnx {C Function} scm_frame_source (frame) Return the source of @var{frame}. @end deffn -@deffn primitive frame? obj +@deffn {Scheme Procedure} frame? obj +@deffnx {C Function} scm_frame_p (obj) Return @code{#t} if @var{obj} is a stack frame. @end deffn -@deffn primitive last-stack-frame obj +@deffn {Scheme Procedure} last-stack-frame obj +@deffnx {C Function} scm_last_stack_frame (obj) Return a stack which consists of a single frame, which is the last stack frame for @var{obj}. @var{obj} must be either a debug object or a continuation. @end deffn -@deffn primitive make-stack obj . args +@deffn {Scheme Procedure} make-stack obj . args +@deffnx {C Function} scm_make_stack (obj, args) Create a new stack. If @var{obj} is @code{#t}, the current evaluation stack is used for creating the stack frames, otherwise the frames are taken from @var{obj} (which must be @@ -165,19 +191,23 @@ If the @var{outer_cut_N} of the last pair is missing, it is taken as 0. @end deffn -@deffn primitive stack-id stack +@deffn {Scheme Procedure} stack-id stack +@deffnx {C Function} scm_stack_id (stack) Return the identifier given to @var{stack} by @code{start-stack}. @end deffn -@deffn primitive stack-length stack +@deffn {Scheme Procedure} stack-length stack +@deffnx {C Function} scm_stack_length (stack) Return the length of @var{stack}. @end deffn -@deffn primitive stack-ref stack index +@deffn {Scheme Procedure} stack-ref stack index +@deffnx {C Function} scm_stack_ref (stack, index) Return the @var{index}'th frame from @var{stack}. @end deffn -@deffn primitive stack? obj +@deffn {Scheme Procedure} stack? obj +@deffnx {C Function} scm_stack_p (obj) Return @code{#t} if @var{obj} is a calling stack. @end deffn diff --git a/doc/ref/scheme-evaluation.texi b/doc/ref/scheme-evaluation.texi index 094214a76..d9854fe6d 100644 --- a/doc/ref/scheme-evaluation.texi +++ b/doc/ref/scheme-evaluation.texi @@ -122,7 +122,8 @@ to use uppercase letters in their identifiers anyway. @node Reader Extensions @subsection Reader Extensions -@deffn primitive read-hash-extend chr proc +@deffn {Scheme Procedure} read-hash-extend chr proc +@deffnx {C Function} scm_read_hash_extend (chr, proc) Install the procedure @var{proc} for reading expressions starting with the character sequence @code{#} and @var{chr}. @var{proc} will be called with two arguments: the character @@ -135,7 +136,8 @@ returned will be the return value of @code{read}. @section Reading Scheme Code @rnindex read -@deffn primitive read [port] +@deffn {Scheme Procedure} read [port] +@deffnx {C Function} scm_read (port) Read an s-expression from the input port @var{port}, or from the current input port if @var{port} is not specified. Any whitespace before the next token is discarded. @@ -149,7 +151,7 @@ available, @xref{Reader options}. @c FIXME::martin: This is taken from libguile/options.c. Is there @c actually a difference between 'help and 'full? -@deffn procedure read-options [setting] +@deffn {Scheme Procedure} read-options [setting] Display the current settings of the read options. If @var{setting} is omitted, only a short form of the current read options is printed. Otherwise, @var{setting} should be one of the following symbols: @@ -161,18 +163,19 @@ Like @code{help}, but also print programmer options. @end table @end deffn -@deffn procedure read-enable option-name -@deffnx procedure read-disable option-name -@deffnx procedure read-set! option-name value +@deffn {Scheme Procedure} read-enable option-name +@deffnx {Scheme Procedure} read-disable option-name +@deffnx {Scheme Procedure} read-set! option-name value Modify the read options. @code{read-enable} should be used with boolean options and switches them on, @code{read-disable} switches them off. @code{read-set!} can be used to set an option to a specific value. @end deffn -@deffn primitive read-options-interface [setting] +@deffn {Scheme Procedure} read-options-interface [setting] +@deffnx {C Function} scm_read_options (setting) Option interface for the read options. Instead of using this procedure directly, use the procedures @code{read-enable}, -@code{read-disable}, @code{read-set!} and @code{read-options}. +@code{read-disable}, @code{read-set!} and @var{read-options}. @end deffn @@ -181,13 +184,18 @@ this procedure directly, use the procedures @code{read-enable}, @rnindex eval @c ARGFIXME environment/environment specifier -@deffn primitive eval exp environment -Evaluate @var{exp}, a list representing a Scheme expression, in the -environment given by @var{environment specifier}. +@deffn {Scheme Procedure} eval exp module +@deffnx {C Function} scm_eval (exp, module) +Evaluate @var{exp}, a list representing a Scheme expression, +in the top-level environment specified by @var{module}. +While @var{exp} is evaluated (using @code{primitive-eval}), +@var{module} is made the current module. The current module +is reset to its previous value when @var{eval} returns. @end deffn @rnindex interaction-environment -@deffn primitive interaction-environment +@deffn {Scheme Procedure} interaction-environment +@deffnx {C Function} scm_interaction_environment () Return a specifier for the environment that contains implementation--defined bindings, typically a superset of those listed in the report. The intent is that this procedure will @@ -195,14 +203,16 @@ return the environment in which the implementation would evaluate expressions dynamically typed by the user. @end deffn -@deffn primitive eval-string string +@deffn {Scheme Procedure} eval-string string +@deffnx {C Function} scm_eval_string (string) Evaluate @var{string} as the text representation of a Scheme form or forms, and return whatever value they produce. Evaluation takes place in the environment returned by the procedure @code{interaction-environment}. @end deffn -@deffn primitive apply:nconc2last lst +@deffn {Scheme Procedure} apply:nconc2last lst +@deffnx {C Function} scm_nconc2last (lst) Given a list (@var{arg1} @dots{} @var{args}), this function conses the @var{arg1} @dots{} arguments onto the front of @var{args}, and returns the resulting list. Note that @@ -213,13 +223,14 @@ destroys its argument, so use with care. @end deffn @rnindex apply -@deffn primitive apply proc arg1 @dots{} args +@deffn {Scheme Procedure} apply proc arg1 @dots{} args @var{proc} must be a procedure and @var{args} must be a list. Call @var{proc} with the elements of the list @code{(append (list @var{arg1} @dots{}) @var{args})} as the actual arguments. @end deffn -@deffn primitive primitive-eval exp +@deffn {Scheme Procedure} primitive-eval exp +@deffnx {C Function} scm_primitive_eval (exp) Evaluate @var{exp} in the top-level environment specified by the current module. @end deffn @@ -229,7 +240,7 @@ the current module. @section Loading Scheme Code from File @rnindex load -@deffn procedure load filename +@deffn {Scheme Procedure} load filename Load @var{filename} and evaluate its contents in the top-level environment. The load paths are not searched. If the variable @code{%load-hook} is defined, it should be bound to a procedure that @@ -237,12 +248,13 @@ will be called before any code is loaded. See documentation for @code{%load-hook} later in this section. @end deffn -@deffn procedure load-from-path filename +@deffn {Scheme Procedure} load-from-path filename Similar to @code{load}, but searches for @var{filename} in the load paths. @end deffn -@deffn primitive primitive-load filename +@deffn {Scheme Procedure} primitive-load filename +@deffnx {C Function} scm_primitive_load (filename) Load the file named @var{filename} and evaluate its contents in the top-level environment. The load paths are not searched; @var{filename} must either be a full pathname or be a pathname @@ -252,14 +264,16 @@ that will be called before any code is loaded. See the documentation for @code{%load-hook} later in this section. @end deffn -@deffn primitive primitive-load-path filename +@deffn {Scheme Procedure} primitive-load-path filename +@deffnx {C Function} scm_primitive_load_path (filename) Search @var{%load-path} for the file named @var{filename} and load it into the top-level environment. If @var{filename} is a relative pathname and is not found in the list of search paths, an error is signalled. @end deffn -@deffn primitive %search-load-path filename +@deffn {Scheme Procedure} %search-load-path filename +@deffnx {C Function} scm_sys_search_load_path (filename) Search @var{%load-path} for the file named @var{filename}, which must be readable by the current user. If @var{filename} is found in the list of paths to search or is an absolute @@ -285,7 +299,8 @@ was passed to @code{primitive-load}. @end defvar -@deffn primitive current-load-port +@deffn {Scheme Procedure} current-load-port +@deffnx {C Function} scm_current_load_port () Return the current-load-port. The load port is used internally by @code{primitive-load}. @end deffn @@ -303,13 +318,15 @@ list @code{("" ".scm")}. [delay] -@deffn primitive promise? obj +@deffn {Scheme Procedure} promise? obj +@deffnx {C Function} scm_promise_p (obj) Return true if @var{obj} is a promise, i.e. a delayed computation (@pxref{Delayed evaluation,,,r5rs.info,The Revised^5 Report on Scheme}). @end deffn @rnindex force -@deffn primitive force x +@deffn {Scheme Procedure} force x +@deffnx {C Function} scm_force (x) If the promise @var{x} has not been computed yet, compute and return @var{x}, otherwise just return the previously computed value. @@ -321,7 +338,8 @@ value. [the-environment] -@deffn primitive local-eval exp [env] +@deffn {Scheme Procedure} local-eval exp [env] +@deffnx {C Function} scm_local_eval (exp, env) Evaluate @var{exp} in its environment. If @var{env} is supplied, it is the environment in which to evaluate @var{exp}. Otherwise, @var{exp} must be a memoized code object (in which case, its environment @@ -343,7 +361,7 @@ available, @xref{Evaluator options}. @c FIXME::martin: This is taken from libguile/options.c. Is there @c actually a difference between 'help and 'full? -@deffn procedure eval-options [setting] +@deffn {Scheme Procedure} eval-options [setting] Display the current settings of the evaluator options. If @var{setting} is omitted, only a short form of the current evaluator options is printed. Otherwise, @var{setting} should be one of the following @@ -356,24 +374,25 @@ Like @code{help}, but also print programmer options. @end table @end deffn -@deffn procedure eval-enable option-name -@deffnx procedure eval-disable option-name -@deffnx procedure eval-set! option-name value +@deffn {Scheme Procedure} eval-enable option-name +@deffnx {Scheme Procedure} eval-disable option-name +@deffnx {Scheme Procedure} eval-set! option-name value Modify the evaluator options. @code{eval-enable} should be used with boolean options and switches them on, @code{eval-disable} switches them off. @code{eval-set!} can be used to set an option to a specific value. @end deffn -@deffn primitive eval-options-interface [setting] +@deffn {Scheme Procedure} eval-options-interface [setting] +@deffnx {C Function} scm_eval_options_interface (setting) Option interface for the evaluation options. Instead of using this procedure directly, use the procedures @code{eval-enable}, -@code{eval-disable}, @code{eval-set!} and @code{eval-options}. +@code{eval-disable}, @code{eval-set!} and @var{eval-options}. @end deffn @c FIXME::martin: Why aren't these procedure named like the other options @c procedures? -@deffn procedure traps [setting] +@deffn {Scheme Procedure} traps [setting] Display the current settings of the evaluator traps options. If @var{setting} is omitted, only a short form of the current evaluator traps options is printed. Otherwise, @var{setting} should be one of the @@ -386,15 +405,16 @@ Like @code{help}, but also print programmer options. @end table @end deffn -@deffn procedure trap-enable option-name -@deffnx procedure trap-disable option-name -@deffnx procedure trap-set! option-name value +@deffn {Scheme Procedure} trap-enable option-name +@deffnx {Scheme Procedure} trap-disable option-name +@deffnx {Scheme Procedure} trap-set! option-name value Modify the evaluator options. @code{trap-enable} should be used with boolean options and switches them on, @code{trap-disable} switches them off. @code{trap-set!} can be used to set an option to a specific value. @end deffn -@deffn primitive evaluator-traps-interface [setting] +@deffn {Scheme Procedure} evaluator-traps-interface [setting] +@deffnx {C Function} scm_evaluator_traps (setting) Option interface for the evaluator trap options. @end deffn diff --git a/doc/ref/scheme-io.texi b/doc/ref/scheme-io.texi index a121823a5..2ea12174d 100644 --- a/doc/ref/scheme-io.texi +++ b/doc/ref/scheme-io.texi @@ -34,20 +34,23 @@ that simulate ports in software. @dfn{Soft ports} and @dfn{string ports} are two interesting and powerful examples of this technique. @rnindex input-port? -@deffn primitive input-port? x +@deffn {Scheme Procedure} input-port? x +@deffnx {C Function} scm_input_port_p (x) Return @code{#t} if @var{x} is an input port, otherwise return @code{#f}. Any object satisfying this predicate also satisfies @code{port?}. @end deffn @rnindex output-port? -@deffn primitive output-port? x +@deffn {Scheme Procedure} output-port? x +@deffnx {C Function} scm_output_port_p (x) Return @code{#t} if @var{x} is an output port, otherwise return @code{#f}. Any object satisfying this predicate also satisfies @code{port?}. @end deffn -@deffn primitive port? x +@deffn {Scheme Procedure} port? x +@deffnx {C Function} scm_port_p (x) Return a boolean indicating whether @var{x} is a port. Equivalent to @code{(or (input-port? @var{x}) (output-port? @var{x}))}. @@ -60,13 +63,15 @@ Equivalent to @code{(or (input-port? @var{x}) (output-port? [Generic procedures for reading from ports.] @rnindex eof-object? -@deffn primitive eof-object? x +@deffn {Scheme Procedure} eof-object? x +@deffnx {C Function} scm_eof_object_p (x) Return @code{#t} if @var{x} is an end-of-file object; otherwise return @code{#f}. @end deffn @rnindex char-ready? -@deffn primitive char-ready? [port] +@deffn {Scheme Procedure} char-ready? [port] +@deffnx {C Function} scm_char_ready_p (port) Return @code{#t} if a character is ready on input @var{port} and return @code{#f} otherwise. If @code{char-ready?} returns @code{#t} then the next @code{read-char} operation on @@ -83,14 +88,16 @@ interactive port that has no ready characters.} @end deffn @rnindex read-char? -@deffn primitive read-char [port] +@deffn {Scheme Procedure} read-char [port] +@deffnx {C Function} scm_read_char (port) Return the next character available from @var{port}, updating @var{port} to point to the following character. If no more characters are available, the end-of-file object is returned. @end deffn @rnindex peek-char? -@deffn primitive peek-char [port] +@deffn {Scheme Procedure} peek-char [port] +@deffnx {C Function} scm_peek_char (port) Return the next character available from @var{port}, @emph{without} updating @var{port} to point to the following character. If no more characters are available, the @@ -105,21 +112,24 @@ an interactive port will hang waiting for input whenever a call to @code{read-char} would have hung.} @end deffn -@deffn primitive unread-char cobj port +@deffn {Scheme Procedure} unread-char cobj [port] +@deffnx {C Function} scm_unread_char (cobj, port) Place @var{char} in @var{port} so that it will be read by the next read operation. If called multiple times, the unread characters will be read again in last-in first-out order. If @var{port} is not supplied, the current input port is used. @end deffn -@deffn primitive unread-string str port +@deffn {Scheme Procedure} unread-string str port +@deffnx {C Function} scm_unread_string (str, port) Place the string @var{str} in @var{port} so that its characters will be read in subsequent read operations. If called multiple times, the unread characters will be read again in last-in first-out order. If @var{port} is not supplied, the current-input-port is used. @end deffn -@deffn primitive drain-input port +@deffn {Scheme Procedure} drain-input port +@deffnx {C Function} scm_drain_input (port) This procedure clears a port's input buffers, similar to the way that force-output clears the output buffer. The contents of the buffers are returned as a single string, e.g., @@ -136,8 +146,10 @@ buffered I/O so that the file descriptor can be used directly for further input. @end deffn -@deffn primitive port-column port -@deffnx primitive port-line port +@deffn {Scheme Procedure} port-column port +@deffnx {Scheme Procedure} port-line port +@deffnx {C Function} scm_port_column (port) +@deffnx {C Function} scm_port_line (port) Return the current column number or line number of @var{port}, using the current input port if none is specified. If the number is unknown, the result is #f. Otherwise, the result is a 0-origin integer @@ -148,8 +160,10 @@ because lines and column numbers traditionally start with 1, and that is what non-programmers will find most natural.) @end deffn -@deffn primitive set-port-column! port column -@deffnx primitive set-port-line! port line +@deffn {Scheme Procedure} set-port-column! port column +@deffnx {Scheme Procedure} set-port-line! port line +@deffnx {C Function} scm_set_port_column_x (port, column) +@deffnx {C Function} scm_set_port_line_x (port, line) Set the current column or line number of @var{port}, using the current input port if none is specified. @end deffn @@ -159,13 +173,14 @@ current input port if none is specified. [Generic procedures for writing to ports.] -@deffn primitive get-print-state port +@deffn {Scheme Procedure} get-print-state port +@deffnx {C Function} scm_get_print_state (port) Return the print state of the port @var{port}. If @var{port} has no associated print state, @code{#f} is returned. @end deffn @rnindex display -@deffn primitive display obj [port] +@deffn {Scheme Procedure} display obj [port] Send a representation of @var{obj} to @var{current-output-port}. Optional second arg @var{port} specifies an alternative output port. The representation is similar to that produced by @code{write} (REFFIXME), @@ -174,23 +189,28 @@ escaped), and characters are rendered as if with @code{write-char}. @end deffn @rnindex newline -@deffn primitive newline [port] -Send a newline to @var{port} (default @var{current-output-port} if omitted). +@deffn {Scheme Procedure} newline [port] +@deffnx {C Function} scm_newline (port) +Send a newline to @var{port}. +If @var{port} is omitted, send to the current output port. @end deffn -@deffn primitive port-with-print-state port pstate +@deffn {Scheme Procedure} port-with-print-state port pstate +@deffnx {C Function} scm_port_with_print_state (port, pstate) Create a new port which behaves like @var{port}, but with an included print state @var{pstate}. @end deffn -@deffn primitive print-options-interface [setting] +@deffn {Scheme Procedure} print-options-interface [setting] +@deffnx {C Function} scm_print_options (setting) Option interface for the print options. Instead of using this procedure directly, use the procedures @code{print-enable}, @code{print-disable}, @code{print-set!} and @code{print-options}. @end deffn -@deffn primitive simple-format destination message . args +@deffn {Scheme Procedure} simple-format destination message . args +@deffnx {C Function} scm_simple_format (destination, message, args) Write @var{message} to @var{destination}, defaulting to the current output port. @var{message} can contain @code{~A} (was @code{%s}) and @@ -205,12 +225,14 @@ containing the formatted text. Does not add a trailing newline. @end deffn @rnindex write-char -@deffn primitive write-char chr [port] +@deffn {Scheme Procedure} write-char chr [port] +@deffnx {C Function} scm_write_char (chr, port) Send character @var{chr} to @var{port}. @end deffn @findex fflush -@deffn primitive force-output [port] +@deffn {Scheme Procedure} force-output [port] +@deffnx {C Function} scm_force_output (port) Flush the specified output port, or the current output port if @var{port} is omitted. The current output buffer contents are passed to the underlying port implementation (e.g., in the case of fports, the @@ -220,7 +242,8 @@ It has no effect on an unbuffered port. The return value is unspecified. @end deffn -@deffn primitive flush-all-ports +@deffn {Scheme Procedure} flush-all-ports +@deffnx {C Function} scm_flush_all_ports () Equivalent to calling @code{force-output} on all open output ports. The return value is unspecified. @end deffn @@ -229,7 +252,8 @@ all open output ports. The return value is unspecified. @node Closing @section Closing -@deffn primitive close-port port +@deffn {Scheme Procedure} close-port port +@deffnx {C Function} scm_close_port (port) Close the specified port object. Return @code{#t} if it successfully closes a port or @code{#f} if it was already closed. An exception may be raised if an error occurs, for @@ -239,7 +263,8 @@ descriptors. @end deffn @rnindex close-input-port -@deffn primitive close-input-port port +@deffn {Scheme Procedure} close-input-port port +@deffnx {C Function} scm_close_input_port (port) Close the specified input port object. The routine has no effect if the file has already been closed. An exception may be raised if an error occurs. The value returned is unspecified. @@ -249,7 +274,8 @@ which can close file descriptors. @end deffn @rnindex close-output-port -@deffn primitive close-output-port port +@deffn {Scheme Procedure} close-output-port port +@deffnx {C Function} scm_close_output_port (port) Close the specified output port object. The routine has no effect if the file has already been closed. An exception may be raised if an error occurs. The value returned is unspecified. @@ -258,7 +284,8 @@ See also @ref{Ports and File Descriptors, close}, for a procedure which can close file descriptors. @end deffn -@deffn primitive port-closed? port +@deffn {Scheme Procedure} port-closed? port +@deffnx {C Function} scm_port_closed_p (port) Return @code{#t} if @var{port} is closed or @code{#f} if it is open. @end deffn @@ -267,7 +294,8 @@ open. @node Random Access @section Random Access -@deffn primitive seek fd_port offset whence +@deffn {Scheme Procedure} seek fd_port offset whence +@deffnx {C Function} scm_seek (fd_port, offset, whence) Sets the current position of @var{fd/port} to the integer @var{offset}, which is interpreted according to the value of @var{whence}. @@ -293,7 +321,8 @@ that the current position of a port can be obtained using: @end lisp @end deffn -@deffn primitive ftell fd_port +@deffn {Scheme Procedure} ftell fd_port +@deffnx {C Function} scm_ftell (fd_port) Return an integer representing the current position of @var{fd/port}, measured from the beginning. Equivalent to: @@ -304,7 +333,8 @@ Return an integer representing the current position of @findex truncate @findex ftruncate -@deffn primitive truncate-file object [length] +@deffn {Scheme Procedure} truncate-file object [length] +@deffnx {C Function} scm_truncate_file (object, length) Truncates the object referred to by @var{object} to at most @var{length} bytes. @var{object} can be a string containing a file name or an integer file descriptor or a port. @@ -328,7 +358,7 @@ module from guile-scsh, but does not use multiple values or character sets and has an extra procedure @code{write-line}. @c begin (scm-doc-string "rdelim.scm" "read-line") -@deffn procedure read-line [port] [handle-delim] +@deffn {Scheme Procedure} read-line [port] [handle-delim] Return a line of text from @var{port} if specified, otherwise from the value returned by @code{(current-input-port)}. Under Unix, a line of text is terminated by the first end-of-line character or by end-of-file. @@ -351,7 +381,7 @@ terminating delimiter or end-of-file object. @end deffn @c begin (scm-doc-string "rdelim.scm" "read-line!") -@deffn procedure read-line! buf [port] +@deffn {Scheme Procedure} read-line! buf [port] Read a line of text into the supplied string @var{buf} and return the number of characters added to @var{buf}. If @var{buf} is filled, then @code{#f} is returned. @@ -360,7 +390,7 @@ specified, otherwise from the value returned by @code{(current-input-port)}. @end deffn @c begin (scm-doc-string "rdelim.scm" "read-delimited") -@deffn procedure read-delimited delims [port] [handle-delim] +@deffn {Scheme Procedure} read-delimited delims [port] [handle-delim] Read text until one of the characters in the string @var{delims} is found or end-of-file is reached. Read from @var{port} if supplied, otherwise from the value returned by @code{(current-input-port)}. @@ -368,7 +398,7 @@ from the value returned by @code{(current-input-port)}. @end deffn @c begin (scm-doc-string "rdelim.scm" "read-delimited!") -@deffn procedure read-delimited! delims buf [port] [handle-delim] [start] [end] +@deffn {Scheme Procedure} read-delimited! delims buf [port] [handle-delim] [start] [end] Read text into the supplied string @var{buf} and return the number of characters added to @var{buf} (subject to @var{handle-delim}, which takes the same values specified for @code{read-line}. If @var{buf} is filled, @@ -379,7 +409,8 @@ or end-of-file is reached. Read from @var{port} if supplied, otherwise from the value returned by @code{(current-input-port)}. @end deffn -@deffn primitive write-line obj [port] +@deffn {Scheme Procedure} write-line obj [port] +@deffnx {C Function} scm_write_line (obj, port) Display @var{obj} and a newline character to @var{port}. If @var{port} is not specified, @code{(current-output-port)} is used. This function is equivalent to: @@ -393,7 +424,8 @@ Some of the abovementioned I/O functions rely on the following C primitives. These will mainly be of interest to people hacking Guile internals. -@deffn primitive %read-delimited! delims str gobble [port [start [end]]] +@deffn {Scheme Procedure} %read-delimited! delims str gobble [port [start [end]]] +@deffnx {C Function} scm_read_delimited_x (delims, str, gobble, port, start, end) Read characters from @var{port} into @var{str} until one of the characters in the @var{delims} string is encountered. If @var{gobble} is true, discard the delimiter character; @@ -411,7 +443,8 @@ at the end of file, the delimiter returned is the a delimiter, this value is @code{#f}. @end deffn -@deffn primitive %read-line [port] +@deffn {Scheme Procedure} %read-line [port] +@deffnx {C Function} scm_read_line (port) Read a newline-terminated line from @var{port}, allocating storage as necessary. The newline terminator (if any) is removed from the string, and a pair consisting of the line and its delimiter is returned. The @@ -432,7 +465,8 @@ The Block-string-I/O module can be accessed with: It currently contains procedures that help to implement the @code{(scsh rw)} module in guile-scsh. -@deffn primitive read-string!/partial str [port_or_fdes [start [end]]] +@deffn {Scheme Procedure} read-string!/partial str [port_or_fdes [start [end]]] +@deffnx {C Function} scm_read_string_x_partial (str, port_or_fdes, start, end) Read characters from a port or file descriptor into a string @var{str}. A port must have an underlying file descriptor --- a so-called fport. This procedure is @@ -472,7 +506,8 @@ end-of-file check. @end itemize @end deffn -@deffn primitive write-string/partial str [port_or_fdes start end] +@deffn {Scheme Procedure} write-string/partial str [port_or_fdes [start [end]]] +@deffnx {C Function} scm_write_string_partial (str, port_or_fdes, start, end) Write characters from a string @var{str} to a port or file descriptor. A port must have an underlying file descriptor --- a so-called fport. This procedure is @@ -520,38 +555,44 @@ return 0 immediately if the request size is 0 bytes. @section Default Ports for Input, Output and Errors @rnindex current-input-port -@deffn primitive current-input-port +@deffn {Scheme Procedure} current-input-port +@deffnx {C Function} scm_current_input_port () Return the current input port. This is the default port used by many input procedures. Initially, @code{current-input-port} returns the @dfn{standard input} in Unix and C terminology. @end deffn @rnindex current-output-port -@deffn primitive current-output-port +@deffn {Scheme Procedure} current-output-port +@deffnx {C Function} scm_current_output_port () Return the current output port. This is the default port used by many output procedures. Initially, @code{current-output-port} returns the @dfn{standard output} in Unix and C terminology. @end deffn -@deffn primitive current-error-port +@deffn {Scheme Procedure} current-error-port +@deffnx {C Function} scm_current_error_port () Return the port to which errors and warnings should be sent (the @dfn{standard error} in Unix and C terminology). @end deffn -@deffn primitive set-current-input-port port -@deffnx primitive set-current-output-port port -@deffnx primitive set-current-error-port port +@deffn {Scheme Procedure} set-current-input-port port +@deffnx {Scheme Procedure} set-current-output-port port +@deffnx {Scheme Procedure} set-current-error-port port +@deffnx {C Function} scm_set_current_input_port (port) +@deffnx {C Function} scm_set_current_output_port (port) +@deffnx {C Function} scm_set_current_error_port (port) Change the ports returned by @code{current-input-port}, @code{current-output-port} and @code{current-error-port}, respectively, so that they use the supplied @var{port} for input or output. @end deffn -@deffn primitive set-current-output-port port +@deffn {Scheme Procedure} set-current-output-port port Set the current default output port to PORT. @end deffn -@deffn primitive set-current-error-port port +@deffn {Scheme Procedure} set-current-error-port port Set the current default error port to PORT. @end deffn @@ -576,7 +617,8 @@ The following procedures are used to open file ports. See also @ref{Ports and File Descriptors, open}, for an interface to the Unix @code{open} system call. -@deffn primitive open-file filename mode +@deffn {Scheme Procedure} open-file filename mode +@deffnx {C Function} scm_open_file (filename, mode) Open the file whose name is @var{filename}, and return a port representing that file. The attributes of the port are determined by the @var{mode} string. The way in which this is @@ -617,7 +659,7 @@ requested, @code{open-file} throws an exception. @end deffn @rnindex open-input-file -@deffn procedure open-input-file filename +@deffn {Scheme Procedure} open-input-file filename Open @var{filename} for input. Equivalent to @smalllisp (open-file @var{filename} "r") @@ -625,7 +667,7 @@ Open @var{filename} for input. Equivalent to @end deffn @rnindex open-output-file -@deffn procedure open-output-file filename +@deffn {Scheme Procedure} open-output-file filename Open @var{filename} for output. Equivalent to @smalllisp (open-file @var{filename} "w") @@ -633,7 +675,7 @@ Open @var{filename} for output. Equivalent to @end deffn @rnindex call-with-input-file -@deffn procedure call-with-input-file file proc +@deffn {Scheme Procedure} call-with-input-file file proc @var{proc} should be a procedure of one argument, and @var{file} should be a string naming a file. The file must already exist. These procedures call @var{proc} with one argument: the port obtained by @@ -646,7 +688,7 @@ never again be used for a read or write operation. @end deffn @rnindex call-with-output-file -@deffn procedure call-with-output-file file proc +@deffn {Scheme Procedure} call-with-output-file file proc @var{proc} should be a procedure of one argument, and @var{file} should be a string naming a file. The behaviour is unspecified if the file already exists. These procedures call @var{proc} with one argument: the @@ -659,7 +701,7 @@ port will never again be used for a read or write operation. @end deffn @rnindex with-input-from-file -@deffn procedure with-input-from-file file thunk +@deffn {Scheme Procedure} with-input-from-file file thunk @var{thunk} must be a procedure of no arguments, and @var{file} must be a string naming a file. The file must already exist. The file is opened for input, an input port connected to it is made the default value @@ -672,7 +714,7 @@ dependent. @end deffn @rnindex with-output-to-file -@deffn procedure with-output-to-file file thunk +@deffn {Scheme Procedure} with-output-to-file file thunk @var{thunk} must be a procedure of no arguments, and @var{file} must be a string naming a file. The effect is unspecified if the file already exists. The file is opened for output, an output port connected to it @@ -684,7 +726,7 @@ used to escape from the continuation of these procedures, their behavior is implementation dependent. @end deffn -@deffn procedure with-error-to-file file thunk +@deffn {Scheme Procedure} with-error-to-file file thunk @var{thunk} must be a procedure of no arguments, and @var{file} must be a string naming a file. The effect is unspecified if the file already exists. The file is opened for output, an output port connected to it @@ -696,27 +738,31 @@ from the continuation of these procedures, their behavior is implementation dependent. @end deffn -@deffn primitive port-mode port -Returns the port modes associated with the open port @var{port}. These -will not necessarily be identical to the modes used when the port was -opened, since modes such as "append" which are used only during -port creation are not retained. +@deffn {Scheme Procedure} port-mode port +@deffnx {C Function} scm_port_mode (port) +Return the port modes associated with the open port @var{port}. +These will not necessarily be identical to the modes used when +the port was opened, since modes such as "append" which are +used only during port creation are not retained. @end deffn -@deffn primitive port-filename port +@deffn {Scheme Procedure} port-filename port +@deffnx {C Function} scm_port_filename (port) Return the filename associated with @var{port}. This function returns the strings "standard input", "standard output" and "standard error" when called on the current input, output and error ports respectively. @end deffn -@deffn primitive set-port-filename! port filename +@deffn {Scheme Procedure} set-port-filename! port filename +@deffnx {C Function} scm_set_port_filename_x (port, filename) Change the filename associated with @var{port}, using the current input port if none is specified. Note that this does not change the port's source of data, but only the value that is returned by @code{port-filename} and reported in diagnostic output. @end deffn -@deffn primitive file-port? obj +@deffn {Scheme Procedure} file-port? obj +@deffnx {C Function} scm_file_port_p (obj) Determine whether @var{obj} is a port that is related to a file. @end deffn @@ -727,38 +773,42 @@ Determine whether @var{obj} is a port that is related to a file. The following allow string ports to be opened by analogy to R4R* file port facilities: -@deffn primitive call-with-output-string proc +@deffn {Scheme Procedure} call-with-output-string proc +@deffnx {C Function} scm_call_with_output_string (proc) Calls the one-argument procedure @var{proc} with a newly created output port. When the function returns, the string composed of the characters written into the port is returned. @end deffn -@deffn primitive call-with-input-string string proc +@deffn {Scheme Procedure} call-with-input-string string proc +@deffnx {C Function} scm_call_with_input_string (string, proc) Calls the one-argument procedure @var{proc} with a newly created input port from which @var{string}'s contents may be read. The value yielded by the @var{proc} is returned. @end deffn -@deffn procedure with-output-to-string thunk +@deffn {Scheme Procedure} with-output-to-string thunk Calls the zero-argument procedure @var{thunk} with the current output port set temporarily to a new string port. It returns a string composed of the characters written to the current output. @end deffn -@deffn procedure with-input-from-string string thunk +@deffn {Scheme Procedure} with-input-from-string string thunk Calls the zero-argument procedure @var{thunk} with the current input port set temporarily to a string port opened on the specified @var{string}. The value yielded by @var{thunk} is returned. @end deffn -@deffn primitive open-input-string str +@deffn {Scheme Procedure} open-input-string str +@deffnx {C Function} scm_open_input_string (str) Take a string and return an input port that delivers characters from the string. The port can be closed by @code{close-input-port}, though its storage will be reclaimed by the garbage collector if it becomes inaccessible. @end deffn -@deffn primitive open-output-string +@deffn {Scheme Procedure} open-output-string +@deffnx {C Function} scm_open_output_string () Return an output port that will accumulate characters for retrieval by @code{get-output-string}. The port can be closed by the procedure @code{close-output-port}, though its storage @@ -766,7 +816,8 @@ will be reclaimed by the garbage collector if it becomes inaccessible. @end deffn -@deffn primitive get-output-string port +@deffn {Scheme Procedure} get-output-string port +@deffnx {C Function} scm_get_output_string (port) Given an output port created by @code{open-output-string}, return a string consisting of the characters that have been output to the port so far. @@ -784,7 +835,8 @@ but trying to extract the file descriptor number will fail. A @dfn{soft-port} is a port based on a vector of procedures capable of accepting or delivering characters. It allows emulation of I/O ports. -@deffn primitive make-soft-port pv modes +@deffn {Scheme Procedure} make-soft-port pv modes +@deffnx {C Function} scm_make_soft_port (pv, modes) Return a port capable of receiving or delivering characters as specified by the @var{modes} string (@pxref{File Ports, open-file}). @var{pv} must be a vector of length 5. Its @@ -835,11 +887,12 @@ For example: This kind of port causes any data to be discarded when written to, and always returns the end-of-file object when read from. -@deffn primitive %make-void-port mode +@deffn {Scheme Procedure} %make-void-port mode +@deffnx {C Function} scm_sys_make_void_port (mode) Create and return a new void port. A void port acts like -@code{/dev/null}. The @var{mode} argument specifies the input/output -modes for this port: see the documentation for @code{open-file} in -@ref{File Ports}. +/dev/null. The @var{mode} argument +specifies the input/output modes for this port: see the +documentation for @code{open-file} in @ref{File Ports}. @end deffn diff --git a/doc/ref/scheme-memory.texi b/doc/ref/scheme-memory.texi index e29fd8607..ee418dbba 100644 --- a/doc/ref/scheme-memory.texi +++ b/doc/ref/scheme-memory.texi @@ -15,26 +15,24 @@ [FIXME: this is pasted in from Tom Lord's original guile.texi and should be reviewed] -@deffn primitive gc +@deffn {Scheme Procedure} gc +@deffnx {C Function} scm_gc () Scans all of SCM objects and reclaims for further use those that are no longer accessible. @end deffn -@deffn primitive gc-stats +@deffn {Scheme Procedure} gc-stats +@deffnx {C Function} scm_gc_stats () Return an association list of statistics about Guile's current use of storage. @end deffn -@deffn primitive object-address obj +@deffn {Scheme Procedure} object-address obj +@deffnx {C Function} scm_object_address (obj) Return an integer that for the lifetime of @var{obj} is uniquely returned by this function for @var{obj} @end deffn -@deffn primitive unhash-name name -Flushes the glocs for @var{name}, or all glocs if @var{name} -is @code{#t}. -@end deffn - @node Weak References @section Weak References @@ -84,9 +82,12 @@ they constitute a doubly-weak table has to be used. @node Weak key hashes @subsection Weak key hashes -@deffn primitive make-weak-key-hash-table size -@deffnx primitive make-weak-value-hash-table size -@deffnx primitive make-doubly-weak-hash-table size +@deffn {Scheme Procedure} make-weak-key-hash-table size +@deffnx {Scheme Procedure} make-weak-value-hash-table size +@deffnx {Scheme Procedure} make-doubly-weak-hash-table size +@deffnx {C Function} scm_make_weak_key_hash_table (size) +@deffnx {C Function} scm_make_weak_value_hash_table (size) +@deffnx {C Function} scm_make_doubly_weak_hash_table (size) Return a weak hash table with @var{size} buckets. As with any hash table, choosing a good size for the table requires some caution. @@ -95,24 +96,27 @@ You can modify weak hash tables in exactly the same way you would modify regular hash tables. (@pxref{Hash Tables}) @end deffn -@deffn primitive weak-key-hash-table? obj -@deffnx primitive weak-value-hash-table? obj -@deffnx primitive doubly-weak-hash-table? obj +@deffn {Scheme Procedure} weak-key-hash-table? obj +@deffnx {Scheme Procedure} weak-value-hash-table? obj +@deffnx {Scheme Procedure} doubly-weak-hash-table? obj +@deffnx {C Function} scm_weak_key_hash_table_p (obj) +@deffnx {C Function} scm_weak_value_hash_table_p (obj) +@deffnx {C Function} scm_doubly_weak_hash_table_p (obj) Return @code{#t} if @var{obj} is the specified weak hash table. Note that a doubly weak hash table is neither a weak key nor a weak value hash table. @end deffn -@deffn primitive make-weak-value-hash-table k +@deffn {Scheme Procedure} make-weak-value-hash-table k @end deffn -@deffn primitive weak-value-hash-table? x +@deffn {Scheme Procedure} weak-value-hash-table? x @end deffn -@deffn primitive make-doubly-weak-hash-table k +@deffn {Scheme Procedure} make-doubly-weak-hash-table k @end deffn -@deffn primitive doubly-weak-hash-table? x +@deffn {Scheme Procedure} doubly-weak-hash-table? x @end deffn @@ -122,22 +126,25 @@ nor a weak value hash table. Weak vectors are mainly useful in Guile's implementation of weak hash tables. -@deffn primitive make-weak-vector size [fill] +@deffn {Scheme Procedure} make-weak-vector size [fill] +@deffnx {C Function} scm_make_weak_vector (size, fill) Return a weak vector with @var{size} elements. If the optional argument @var{fill} is given, all entries in the vector will be set to @var{fill}. The default value for @var{fill} is the empty list. @end deffn -@deffn primitive weak-vector . l -@deffnx primitive list->weak-vector l +@deffn {Scheme Procedure} weak-vector . l +@deffnx {Scheme Procedure} list->weak-vector l +@deffnx {C Function} scm_weak_vector (l) Construct a weak vector from a list: @code{weak-vector} uses the list of its arguments while @code{list->weak-vector} uses its only argument @var{l} (a list) to construct a weak vector the same way @code{list->vector} would. @end deffn -@deffn primitive weak-vector? obj +@deffn {Scheme Procedure} weak-vector? obj +@deffnx {C Function} scm_weak_vector_p (obj) Return @code{#t} if @var{obj} is a weak vector. Note that all weak hashes are also weak vectors. @end deffn @@ -146,7 +153,8 @@ weak hashes are also weak vectors. @node Guardians @section Guardians -@deffn primitive make-guardian [greedy?] +@deffn {Scheme Procedure} make-guardian [greedy?] +@deffnx {C Function} scm_make_guardian (greedy_p) Create a new guardian. A guardian protects a set of objects from garbage collection, allowing a program to apply cleanup or other actions. @@ -174,17 +182,20 @@ and Implementation, June 1993. paper still (mostly) accurately describes the interface). @end deffn -@deffn primitive destroy-guardian! guardian +@deffn {Scheme Procedure} destroy-guardian! guardian +@deffnx {C Function} scm_destroy_guardian_x (guardian) Destroys @var{guardian}, by making it impossible to put any more objects in it or get any objects from it. It also unguards any objects guarded by @var{guardian}. @end deffn -@deffn primitive guardian-greedy? guardian +@deffn {Scheme Procedure} guardian-greedy? guardian +@deffnx {C Function} scm_guardian_greedy_p (guardian) Return @code{#t} if @var{guardian} is a greedy guardian, otherwise @code{#f}. @end deffn -@deffn primitive guardian-destroyed? guardian +@deffn {Scheme Procedure} guardian-destroyed? guardian +@deffnx {C Function} scm_guardian_destroyed_p (guardian) Return @code{#t} if @var{guardian} has been destroyed, otherwise @code{#f}. @end deffn @@ -193,25 +204,30 @@ Return @code{#t} if @var{guardian} has been destroyed, otherwise @code{#f}. @node Objects @chapter Objects -@deffn primitive entity? obj +@deffn {Scheme Procedure} entity? obj +@deffnx {C Function} scm_entity_p (obj) Return @code{#t} if @var{obj} is an entity. @end deffn -@deffn primitive operator? obj +@deffn {Scheme Procedure} operator? obj +@deffnx {C Function} scm_operator_p (obj) Return @code{#t} if @var{obj} is an operator. @end deffn -@deffn primitive set-object-procedure! obj proc +@deffn {Scheme Procedure} set-object-procedure! obj proc +@deffnx {C Function} scm_set_object_procedure_x (obj, proc) Set the object procedure of @var{obj} to @var{proc}. @var{obj} must be either an entity or an operator. @end deffn -@deffn primitive make-class-object metaclass layout +@deffn {Scheme Procedure} make-class-object metaclass layout +@deffnx {C Function} scm_make_class_object (metaclass, layout) Create a new class object of class @var{metaclass}, with the slot layout specified by @var{layout}. @end deffn -@deffn primitive make-subclass-object class layout +@deffn {Scheme Procedure} make-subclass-object class layout +@deffnx {C Function} scm_make_subclass_object (class, layout) Create a subclass object of @var{class}, with the slot layout specified by @var{layout}. @end deffn diff --git a/doc/ref/scheme-modules.texi b/doc/ref/scheme-modules.texi index 70cbd94d7..ac6ead1e8 100644 --- a/doc/ref/scheme-modules.texi +++ b/doc/ref/scheme-modules.texi @@ -193,7 +193,7 @@ This example also shows how to use the convenience procedure @code{symbol-prefix-proc}. @c begin (scm-doc-string "boot-9.scm" "symbol-prefix-proc") -@deffn procedure symbol-prefix-proc prefix-sym +@deffn {Scheme Procedure} symbol-prefix-proc prefix-sym Return a procedure that prefixes its arg (a symbol) with @var{prefix-sym}. @c Insert gratuitous C++ slam here. --ttn @@ -332,7 +332,8 @@ The procedures in this section are useful if you want to dig into the innards of Guile's module system. If you don't know precisely what you do, you should probably avoid using any of them. -@deffn primitive standard-eval-closure module +@deffn {Scheme Procedure} standard-eval-closure module +@deffnx {C Function} scm_standard_eval_closure (module) Return an eval closure for the module @var{module}. @end deffn @@ -495,7 +496,8 @@ When using the low level procedures to do your dynamic linking, you have complete control over which library is loaded when and what get's done with it. -@deffn primitive dynamic-link library +@deffn {Scheme Procedure} dynamic-link library +@deffnx {C Function} scm_dynamic_link (library) Find the shared library denoted by @var{library} (a string) and link it into the running Guile application. When everything works out, return a Scheme object suitable for representing the linked object file. @@ -507,24 +509,26 @@ that will be searched for in the places where shared libraries usually reside, such as in @file{/usr/lib} and @file{/usr/local/lib}. @end deffn -@deffn primitive dynamic-object? val -Determine whether @var{val} represents a dynamically linked object file. +@deffn {Scheme Procedure} dynamic-object? obj +@deffnx {C Function} scm_dynamic_object_p (obj) +Return @code{#t} if @var{obj} is a dynamic library handle, or @code{#f} +otherwise. @end deffn -@deffn primitive dynamic-unlink dynobj -Unlink the indicated object file from the application. The argument -@var{dynobj} should be one of the values returned by -@code{dynamic-link}. When @code{dynamic-unlink} has been called on -@var{dynobj}, it is no longer usable as an argument to the functions -below and you will get type mismatch errors when you try to. +@deffn {Scheme Procedure} dynamic-unlink dobj +@deffnx {C Function} scm_dynamic_unlink (dobj) +Unlink the indicated object file from the application. The +argument @var{dobj} must have been obtained by a call to +@code{dynamic-link}. After @code{dynamic-unlink} has been +called on @var{dobj}, its content is no longer accessible. @end deffn -@deffn primitive dynamic-func function dynobj -Search the C function indicated by @var{function} (a string or symbol) -in @var{dynobj} and return some Scheme object that can later be used -with @code{dynamic-call} to actually call this function. Right now, -these Scheme objects are formed by casting the address of the function -to @code{long} and converting this number to its Scheme representation. +@deffn {Scheme Procedure} dynamic-func name dobj +@deffnx {C Function} scm_dynamic_func (name, dobj) +Search the dynamic object @var{dobj} for the C function +indicated by the string @var{name} and return some Scheme +handle that can later be used with @code{dynamic-call} to +actually call the function. Regardless whether your C compiler prepends an underscore @samp{_} to the global names in a program, you should @strong{not} include this @@ -532,35 +536,37 @@ underscore in @var{function}. Guile knows whether the underscore is needed or not and will add it when necessary. @end deffn -@deffn primitive dynamic-call function dynobj -Call the C function indicated by @var{function} and @var{dynobj}. The -function is passed no arguments and its return value is ignored. When -@var{function} is something returned by @code{dynamic-func}, call that -function and ignore @var{dynobj}. When @var{function} is a string (or -symbol, etc.), look it up in @var{dynobj}; this is equivalent to - +@deffn {Scheme Procedure} dynamic-call func dobj +@deffnx {C Function} scm_dynamic_call (func, dobj) +Call the C function indicated by @var{func} and @var{dobj}. +The function is passed no arguments and its return value is +ignored. When @var{function} is something returned by +@code{dynamic-func}, call that function and ignore @var{dobj}. +When @var{func} is a string , look it up in @var{dynobj}; this +is equivalent to @smallexample -(dynamic-call (dynamic-func @var{function} @var{dynobj} #f)) +(dynamic-call (dynamic-func @var{func} @var{dobj} #f)) @end smallexample Interrupts are deferred while the C function is executing (with @code{SCM_DEFER_INTS}/@code{SCM_ALLOW_INTS}). @end deffn -@deffn primitive dynamic-args-call function dynobj args -Call the C function indicated by @var{function} and @var{dynobj}, just -like @code{dynamic-call}, but pass it some arguments and return its -return value. The C function is expected to take two arguments and -return an @code{int}, just like @code{main}: - +@deffn {Scheme Procedure} dynamic-args-call func dobj args +@deffnx {C Function} scm_dynamic_args_call (func, dobj, args) +Call the C function indicated by @var{func} and @var{dobj}, +just like @code{dynamic-call}, but pass it some arguments and +return its return value. The C function is expected to take +two arguments and return an @code{int}, just like @code{main}: @smallexample int c_func (int argc, char **argv); @end smallexample -The parameter @var{args} must be a list of strings and is converted into -an array of @code{char *}. The array is passed in @var{argv} and its -size in @var{argc}. The return value is converted to a Scheme number -and returned from the call to @code{dynamic-args-call}. +The parameter @var{args} must be a list of strings and is +converted into an array of @code{char *}. The array is passed +in @var{argv} and its size in @var{argc}. The return value is +converted to a Scheme number and returned from the call to +@code{dynamic-args-call}. @end deffn When dynamic linking is disabled or not supported on your system, diff --git a/doc/ref/scheme-options.texi b/doc/ref/scheme-options.texi index e4da66355..3b24463ba 100644 --- a/doc/ref/scheme-options.texi +++ b/doc/ref/scheme-options.texi @@ -34,11 +34,11 @@ We will use the expression @code{<group>} to represent @code{read}, @subheading Low level @c NJFIXME -@deffn primitive <group>-options-interface -@deffnx primitive read-options-interface [SOME-INT] -@deffnx primitive print-options-interface [SOME-INT] -@deffnx primitive evaluator-traps-interface [SOME-INT] -@deffnx primitive read-options-interface [SOME-INT] +@deffn {Scheme Procedure} <group>-options-interface +@deffnx {Scheme Procedure} read-options-interface [SOME-INT] +@deffnx {Scheme Procedure} print-options-interface [SOME-INT] +@deffnx {Scheme Procedure} evaluator-traps-interface [SOME-INT] +@deffnx {Scheme Procedure} read-options-interface [SOME-INT] [FIXME: I have just taken the comments for C routine scm_options that implements all of these. It needs to be presented better.] @@ -59,11 +59,11 @@ and documentation string. @c @end deftp @c NJFIXME -@deffn procedure <group>-options [arg] -@deffnx procedure read-options [arg] -@deffnx procedure print-options [arg] -@deffnx procedure debug-options [arg] -@deffnx procedure traps [arg] +@deffn {Scheme Procedure} <group>-options [arg] +@deffnx {Scheme Procedure} read-options [arg] +@deffnx {Scheme Procedure} print-options [arg] +@deffnx {Scheme Procedure} debug-options [arg] +@deffnx {Scheme Procedure} traps [arg] These functions list the options in their group. The optional argument @var{arg} is a symbol which modifies the form in which the options are presented. @@ -81,22 +81,22 @@ options) and symbols followed by values. up?] @c NJFIXME -@deffn procedure <group>-enable option-symbol -@deffnx procedure read-enable option-symbol -@deffnx procedure print-enable option-symbol -@deffnx procedure debug-enable option-symbol -@deffnx procedure trap-enable option-symbol +@deffn {Scheme Procedure} <group>-enable option-symbol +@deffnx {Scheme Procedure} read-enable option-symbol +@deffnx {Scheme Procedure} print-enable option-symbol +@deffnx {Scheme Procedure} debug-enable option-symbol +@deffnx {Scheme Procedure} trap-enable option-symbol These functions set the specified @var{option-symbol} in their options group. They only work if the option is boolean, and throw an error otherwise. @end deffn @c NJFIXME -@deffn procedure <group>-disable option-symbol -@deffnx procedure read-disable option-symbol -@deffnx procedure print-disable option-symbol -@deffnx procedure debug-disable option-symbol -@deffnx procedure trap-disable option-symbol +@deffn {Scheme Procedure} <group>-disable option-symbol +@deffnx {Scheme Procedure} read-disable option-symbol +@deffnx {Scheme Procedure} print-disable option-symbol +@deffnx {Scheme Procedure} debug-disable option-symbol +@deffnx {Scheme Procedure} trap-disable option-symbol These functions turn off the specified @var{option-symbol} in their options group. They only work if the option is boolean, and throw an error otherwise. @@ -331,10 +331,14 @@ It is often useful to have site-specific information about the current Guile installation. This chapter describes how to find out about Guile's configuration at run time. -@deffn primitive version -@deffnx primitive major-version -@deffnx primitive minor-version -@deffnx primitive micro-version +@deffn {Scheme Procedure} version +@deffnx {Scheme Procedure} major-version +@deffnx {Scheme Procedure} minor-version +@deffnx {Scheme Procedure} micro-version +@deffnx {C Function} scm_version () +@deffnx {C Function} scm_major_version () +@deffnx {C Function} scm_minor_version () +@deffnx {C Function} scm_micro_version () Return a string describing Guile's version number, or its major, minor or micro version number, respectively. @@ -347,37 +351,42 @@ or micro version number, respectively. @end deffn @c NJFIXME not in libguile! -@deffn primitive libguile-config-stamp +@deffn {Scheme Procedure} libguile-config-stamp Return a string describing the date on which @code{libguile} was configured. This is used to determine whether the Guile core interpreter and the ice-9 runtime have grown out of date with one another. @end deffn -@deffn primitive %package-data-dir +@deffn {Scheme Procedure} %package-data-dir +@deffnx {C Function} scm_sys_package_data_dir () Return the name of the directory where Scheme packages, modules and libraries are kept. On most Unix systems, this will be @samp{/usr/local/share/guile}. @end deffn -@deffn primitive %library-dir +@deffn {Scheme Procedure} %library-dir +@deffnx {C Function} scm_sys_library_dir () Return the directory where the Guile Scheme library files are installed. E.g., may return "/usr/share/guile/1.3.5". @end deffn -@deffn primitive %site-dir +@deffn {Scheme Procedure} %site-dir +@deffnx {C Function} scm_sys_site_dir () Return the directory where the Guile site files are installed. E.g., may return "/usr/share/guile/site". @end deffn -@deffn primitive parse-path path [tail] +@deffn {Scheme Procedure} parse-path path [tail] +@deffnx {C Function} scm_parse_path (path, tail) Parse @var{path}, which is expected to be a colon-separated string, into a list and return the resulting list with @var{tail} appended. If @var{path} is @code{#f}, @var{tail} is returned. @end deffn -@deffn primitive search-path path filename [extensions] +@deffn {Scheme Procedure} search-path path filename [extensions] +@deffnx {C Function} scm_search_path (path, filename, extensions) Search @var{path} for a directory containing a file named @var{filename}. The file must be readable, and not a directory. If we find one, return its full filename; otherwise, return diff --git a/doc/ref/scheme-procedures.texi b/doc/ref/scheme-procedures.texi index 4a4830358..bc186c9e5 100644 --- a/doc/ref/scheme-procedures.texi +++ b/doc/ref/scheme-procedures.texi @@ -347,15 +347,18 @@ for primitive procedures, and @code{thunk?} only returns @code{#t} for procedures which do not accept any arguments. @rnindex procedure? -@deffn primitive procedure? obj +@deffn {Scheme Procedure} procedure? obj +@deffnx {C Function} scm_procedure_p (obj) Return @code{#t} if @var{obj} is a procedure. @end deffn -@deffn primitive closure? obj +@deffn {Scheme Procedure} closure? obj +@deffnx {C Function} scm_closure_p (obj) Return @code{#t} if @var{obj} is a closure. @end deffn -@deffn primitive thunk? obj +@deffn {Scheme Procedure} thunk? obj +@deffnx {C Function} scm_thunk_p (obj) Return @code{#t} if @var{obj} is a thunk. @end deffn @@ -365,19 +368,23 @@ Procedure properties are general properties to be attached to procedures. These can be the name of a procedure or other relevant information, such as debug hints. -@deffn primitive procedure-properties proc +@deffn {Scheme Procedure} procedure-properties proc +@deffnx {C Function} scm_procedure_properties (proc) Return @var{obj}'s property list. @end deffn -@deffn primitive procedure-property p k +@deffn {Scheme Procedure} procedure-property obj key +@deffnx {C Function} scm_procedure_property (obj, key) Return the property of @var{obj} with name @var{key}. @end deffn -@deffn primitive set-procedure-properties! proc new_val +@deffn {Scheme Procedure} set-procedure-properties! proc alist +@deffnx {C Function} scm_set_procedure_properties_x (proc, alist) Set @var{obj}'s property list to @var{alist}. @end deffn -@deffn primitive set-procedure-property! p k v +@deffn {Scheme Procedure} set-procedure-property! obj key value +@deffnx {C Function} scm_set_procedure_property_x (obj, key, value) In @var{obj}'s property list, set the property named @var{key} to @var{value}. @end deffn @@ -386,7 +393,8 @@ In @var{obj}'s property list, set the property named @var{key} to Documentation for a procedure can be accessed with the procedure @code{procedure-documentation}. -@deffn primitive procedure-documentation proc +@deffn {Scheme Procedure} procedure-documentation proc +@deffnx {C Function} scm_procedure_documentation (proc) Return the documentation string associated with @code{proc}. By convention, if a procedure contains more than one expression and the first expression is a string constant, that string is assumed to contain @@ -398,22 +406,26 @@ documentation for that procedure. Source properties are properties which are related to the source code of a procedure, such as the line and column numbers, the file name etc. -@deffn primitive set-source-properties! obj plist +@deffn {Scheme Procedure} set-source-properties! obj plist +@deffnx {C Function} scm_set_source_properties_x (obj, plist) Install the association list @var{plist} as the source property list for @var{obj}. @end deffn -@deffn primitive set-source-property! obj key datum +@deffn {Scheme Procedure} set-source-property! obj key datum +@deffnx {C Function} scm_set_source_property_x (obj, key, datum) Set the source property of object @var{obj}, which is specified by @var{key} to @var{datum}. Normally, the key will be a symbol. @end deffn -@deffn primitive source-properties obj +@deffn {Scheme Procedure} source-properties obj +@deffnx {C Function} scm_source_properties (obj) Return the source property association list of @var{obj}. @end deffn -@deffn primitive source-property obj key +@deffn {Scheme Procedure} source-property obj key +@deffnx {C Function} scm_source_property (obj, key) Return the source property specified by @var{key} from @var{obj}'s source property list. @end deffn @@ -480,22 +492,25 @@ structure stored in @code{f}, or to write into the structure. (foo f 0) @result{} dum @end lisp -@deffn primitive make-procedure-with-setter procedure setter +@deffn {Scheme Procedure} make-procedure-with-setter procedure setter +@deffnx {C Function} scm_make_procedure_with_setter (procedure, setter) Create a new procedure which behaves like @var{procedure}, but with the associated setter @var{setter}. @end deffn -@deffn primitive procedure-with-setter? obj +@deffn {Scheme Procedure} procedure-with-setter? obj +@deffnx {C Function} scm_procedure_with_setter_p (obj) Return @code{#t} if @var{obj} is a procedure with an associated setter procedure. @end deffn -@deffn primitive procedure proc +@deffn {Scheme Procedure} procedure proc +@deffnx {C Function} scm_procedure (proc) Return the procedure of @var{proc}, which must be either a procedure with setter, or an operator struct. @end deffn -@deffn primitive setter proc +@deffn {Scheme Procedure} setter proc Return the setter of @var{proc}, which must be either a procedure with setter or an operator struct. @end deffn @@ -710,30 +725,34 @@ change. Use @code{defmacro}, @code{define-macro} (@pxref{Macros}) or terms, @code{defmacro}, @code{define-macro} and @code{define-syntax} are all implemented as mmacros.) -@deffn primitive procedure->syntax code -Return a macro which, when a symbol defined to this value appears as the -first symbol in an expression, returns the result of applying @var{code} -to the expression and the environment. +@deffn {Scheme Procedure} procedure->syntax code +@deffnx {C Function} scm_makacro (code) +Return a @dfn{macro} which, when a symbol defined to this value +appears as the first symbol in an expression, returns the +result of applying @var{code} to the expression and the +environment. @end deffn -@deffn primitive procedure->macro code -Return a macro which, when a symbol defined to this value appears as the -first symbol in an expression, evaluates the result of applying -@var{code} to the expression and the environment. For example: +@deffn {Scheme Procedure} procedure->macro code +@deffnx {C Function} scm_makmacro (code) +Return a @dfn{macro} which, when a symbol defined to this value +appears as the first symbol in an expression, evaluates the +result of applying @var{code} to the expression and the +environment. The value returned from @var{code} which has been +passed to @code{procedure->memoizing-macro} replaces the form +passed to @var{code}. For example: @lisp (define trace (procedure->macro - (lambda (x env) - `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x)))))) + (lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x)))))) -(trace @i{foo}) -@equiv{} -(set! @i{foo} (tracef @i{foo} '@i{foo})). +(trace @i{foo}) @equiv{} (set! @i{foo} (tracef @i{foo} '@i{foo})). @end lisp @end deffn -@deffn primitive procedure->memoizing-macro code +@deffn {Scheme Procedure} procedure->memoizing-macro code +@deffnx {C Function} scm_makmmacro (code) Return a macro which, when a symbol defined to this value appears as the first symbol in an expression, evaluates the result of applying @var{code} to the expression and the environment. @@ -746,12 +765,14 @@ of the containing code. In the following primitives, @dfn{acro} flavour macros are referred to as @dfn{syntax transformers}. -@deffn primitive macro? obj +@deffn {Scheme Procedure} macro? obj +@deffnx {C Function} scm_macro_p (obj) Return @code{#t} if @var{obj} is a regular macro, a memoizing macro or a syntax transformer. @end deffn -@deffn primitive macro-type m +@deffn {Scheme Procedure} macro-type m +@deffnx {C Function} scm_macro_type (m) Return one of the symbols @code{syntax}, @code{macro} or @code{macro!}, depending on whether @var{m} is a syntax transformer, a regular macro, or a memoizing macro, @@ -759,15 +780,18 @@ respectively. If @var{m} is not a macro, @code{#f} is returned. @end deffn -@deffn primitive macro-name m +@deffn {Scheme Procedure} macro-name m +@deffnx {C Function} scm_macro_name (m) Return the name of the macro @var{m}. @end deffn -@deffn primitive macro-transformer m +@deffn {Scheme Procedure} macro-transformer m +@deffnx {C Function} scm_macro_transformer (m) Return the transformer of the macro @var{m}. @end deffn -@deffn primitive cons-source xorig x y +@deffn {Scheme Procedure} cons-source xorig x y +@deffnx {C Function} scm_cons_source (xorig, x, y) Create and return a new pair whose car and cdr are @var{x} and @var{y}. Any source properties associated with @var{xorig} are also associated with the new pair. diff --git a/doc/ref/scheme-scheduling.texi b/doc/ref/scheme-scheduling.texi index e2cdd3d2a..920a73029 100644 --- a/doc/ref/scheme-scheduling.texi +++ b/doc/ref/scheme-scheduling.texi @@ -30,18 +30,21 @@ otherwise it will fail and return @code{#f}. Once an arbiter is successfully locked, it cannot be locked by another thread until the thread holding the arbiter calls @code{release-arbiter} to unlock it. -@deffn primitive make-arbiter name +@deffn {Scheme Procedure} make-arbiter name +@deffnx {C Function} scm_make_arbiter (name) Return an object of type arbiter and name @var{name}. Its state is initially unlocked. Arbiters are a way to achieve process synchronization. @end deffn -@deffn primitive try-arbiter arb +@deffn {Scheme Procedure} try-arbiter arb +@deffnx {C Function} scm_try_arbiter (arb) Return @code{#t} and lock the arbiter @var{arb} if the arbiter was unlocked. Otherwise, return @code{#f}. @end deffn -@deffn primitive release-arbiter arb +@deffn {Scheme Procedure} release-arbiter arb +@deffnx {C Function} scm_release_arbiter (arb) Return @code{#t} and unlock the arbiter @var{arb} if the arbiter was locked. Otherwise, return @code{#f}. @end deffn @@ -70,20 +73,24 @@ Normal asyncs are created with @code{async}, system asyncs with @code{system-async}. They are marked with @code{async-mark} or @code{system-async-mark}, respectively. -@deffn primitive async thunk +@deffn {Scheme Procedure} async thunk +@deffnx {C Function} scm_async (thunk) Create a new async for the procedure @var{thunk}. @end deffn -@deffn primitive system-async thunk +@deffn {Scheme Procedure} system-async thunk +@deffnx {C Function} scm_system_async (thunk) Create a new async for the procedure @var{thunk}. Also add it to the system's list of active async objects. @end deffn -@deffn primitive async-mark a +@deffn {Scheme Procedure} async-mark a +@deffnx {C Function} scm_async_mark (a) Mark the async @var{a} for future execution. @end deffn -@deffn primitive system-async-mark a +@deffn {Scheme Procedure} system-async-mark a +@deffnx {C Function} scm_system_async_mark (a) Mark the async @var{a} for future execution. @end deffn @@ -91,7 +98,8 @@ As already mentioned above, system asyncs are executed automatically. Normal asyncs have to be explicitly invoked by storing one or more of them into a list and passing them to @code{run-asyncs}. -@deffn primitive run-asyncs list_of_a +@deffn {Scheme Procedure} run-asyncs list_of_a +@deffnx {C Function} scm_run_asyncs (list_of_a) Execute all thunks from the asyncs of the list @var{list_of_a}. @end deffn @@ -102,18 +110,21 @@ run once execution is enabled again. Please note that calls to these procedures should always be paired, and they must not be nested, e.g. no @code{mask-signals} is allowed if another one is still active. -@deffn primitive mask-signals +@deffn {Scheme Procedure} mask-signals +@deffnx {C Function} scm_mask_signals () Mask signals. The returned value is not specified. @end deffn -@deffn primitive unmask-signals +@deffn {Scheme Procedure} unmask-signals +@deffnx {C Function} scm_unmask_signals () Unmask signals. The returned value is not specified. @end deffn @c FIXME::martin: Find an example for usage of `noop'. What is that @c procedure for anyway? -@deffn primitive noop . args +@deffn {Scheme Procedure} noop . args +@deffnx {C Function} scm_noop (args) Do nothing. When called without arguments, return @code{#f}, otherwise return the first argument. @end deffn @@ -139,7 +150,8 @@ dynamic root. For example, if you want to apply a procedure, but to not allow that procedure to capture the current continuation, calling the procedure under a new dynamic root will do the job. -@deffn primitive call-with-dynamic-root thunk handler +@deffn {Scheme Procedure} call-with-dynamic-root thunk handler +@deffnx {C Function} scm_call_with_dynamic_root (thunk, handler) Evaluate @code{(thunk)} in a new dynamic context, returning its value. If an error occurs during evaluation, apply @var{handler} to the @@ -185,7 +197,8 @@ be under a new dynamic root.) @end deffn -@deffn primitive dynamic-root +@deffn {Scheme Procedure} dynamic-root +@deffnx {C Function} scm_dynamic_root () Return an object representing the current dynamic root. These objects are only useful for comparison using @code{eq?}. @@ -194,7 +207,7 @@ in no way depend on this. @end deffn @c begin (scm-doc-string "boot-9.scm" "quit") -@deffn procedure quit [exit_val] +@deffn {Scheme Procedure} quit [exit_val] Throw back to the error handler of the current dynamic root. If integer @var{exit_val} is specified and if Guile is being used @@ -215,12 +228,12 @@ from Scheme code to be removed. An example of where this is useful is after forking a new process intended to run non-interactively. @c begin (scm-doc-string "boot-9.scm" "batch-mode?") -@deffn procedure batch-mode? +@deffn {Scheme Procedure} batch-mode? Returns a boolean indicating whether the interpreter is in batch mode. @end deffn @c begin (scm-doc-string "boot-9.scm" "set-batch-mode?!") -@deffn procedure set-batch-mode?! arg +@deffn {Scheme Procedure} set-batch-mode?! arg If @var{arg} is true, switches the interpreter to batch mode. The @code{#f} case has not been implemented. @end deffn @@ -258,7 +271,7 @@ executed in a new dynamic root. @c are in sync. @c begin (texi-doc-string "guile" "call-with-new-thread") -@deffn primitive call-with-new-thread thunk error-handler +@deffn {Scheme Procedure} call-with-new-thread thunk error-handler Evaluate @code{(thunk)} in a new thread, and new dynamic context, returning a new thread object representing the thread. @@ -273,31 +286,31 @@ All the evaluation rules for dynamic roots apply to threads. @end deffn @c begin (texi-doc-string "guile" "join-thread") -@deffn primitive join-thread thread +@deffn {Scheme Procedure} join-thread thread Suspend execution of the calling thread until the target @var{thread} terminates, unless the target @var{thread} has already terminated. @end deffn @c begin (texi-doc-string "guile" "yield") -@deffn primitive yield +@deffn {Scheme Procedure} yield If one or more threads are waiting to execute, calling yield forces an immediate context switch to one of them. Otherwise, yield has no effect. @end deffn @c begin (texi-doc-string "guile" "make-mutex") -@deffn primitive make-mutex +@deffn {Scheme Procedure} make-mutex Create a new mutex object. @end deffn @c begin (texi-doc-string "guile" "lock-mutex") -@deffn primitive lock-mutex mutex +@deffn {Scheme Procedure} lock-mutex mutex Lock @var{mutex}. If the mutex is already locked, the calling thread blocks until the mutex becomes available. The function returns when the calling thread owns the lock on @var{mutex}. @end deffn @c begin (texi-doc-string "guile" "unlock-mutex") -@deffn primitive unlock-mutex mutex +@deffn {Scheme Procedure} unlock-mutex mutex Unlocks @var{mutex} if the calling thread owns the lock on @var{mutex}. Calling unlock-mutex on a mutex not owned by the current thread results in undefined behaviour. Once a mutex has been unlocked, one thread @@ -305,15 +318,15 @@ blocked on @var{mutex} is awakened and grabs the mutex lock. @end deffn @c begin (texi-doc-string "guile" "make-condition-variable") -@deffn primitive make-condition-variable +@deffn {Scheme Procedure} make-condition-variable @end deffn @c begin (texi-doc-string "guile" "wait-condition-variable") -@deffn primitive wait-condition-variable cond-var mutex +@deffn {Scheme Procedure} wait-condition-variable cond-var mutex @end deffn @c begin (texi-doc-string "guile" "signal-condition-variable") -@deffn primitive signal-condition-variable cond-var +@deffn {Scheme Procedure} signal-condition-variable cond-var @end deffn @@ -326,7 +339,7 @@ Higher level thread procedures are available by loading the @code{(ice-9 threads)} module. These provide standardized thread creation and mutex interaction. -@deffn primitive %thread-handler tag args@dots{} +@deffn {Scheme Procedure} %thread-handler tag args@dots{} This procedure is specified as the standard error-handler for @code{make-thread} and @code{begin-thread}. If the number of @var{args} @@ -390,7 +403,8 @@ in Scheme---this cannot happen. See the description of New fluids are created with @code{make-fluid} and @code{fluid?} is used for testing whether an object is actually a fluid. -@deffn primitive make-fluid +@deffn {Scheme Procedure} make-fluid +@deffnx {C Function} scm_make_fluid () Return a newly created fluid. Fluids are objects of a certain type (a smob) that can hold one SCM value per dynamic root. That is, modifications to this value are @@ -400,7 +414,8 @@ inherits the values from its parent. Because each thread executes in its own dynamic root, you can use fluids for thread local storage. @end deffn -@deffn primitive fluid? obj +@deffn {Scheme Procedure} fluid? obj +@deffnx {C Function} scm_fluid_p (obj) Return @code{#t} iff @var{obj} is a fluid; otherwise, return @code{#f}. @end deffn @@ -408,13 +423,15 @@ Return @code{#t} iff @var{obj} is a fluid; otherwise, return The values stored in a fluid can be accessed with @code{fluid-ref} and @code{fluid-set!}. -@deffn primitive fluid-ref fluid +@deffn {Scheme Procedure} fluid-ref fluid +@deffnx {C Function} scm_fluid_ref (fluid) Return the value associated with @var{fluid} in the current dynamic root. If @var{fluid} has not been set, then return @code{#f}. @end deffn -@deffn primitive fluid-set! fluid value +@deffn {Scheme Procedure} fluid-set! fluid value +@deffnx {C Function} scm_fluid_set_x (fluid, value) Set the value associated with @var{fluid} in the current dynamic root. @end deffn @@ -422,7 +439,8 @@ Set the value associated with @var{fluid} in the current dynamic root. so that the given procedure and each procedure called by it access the given values. After the procedure returns, the old values are restored. -@deffn primitive with-fluids* fluids values thunk +@deffn {Scheme Procedure} with-fluids* fluids values thunk +@deffnx {C Function} scm_with_fluids (fluids, values, thunk) Set @var{fluids} to @var{values} temporary, and call @var{thunk}. @var{fluids} must be a list of fluids and @var{values} must be the same number of their values to be applied. Each substitution is done diff --git a/doc/ref/scheme-translation.texi b/doc/ref/scheme-translation.texi index c01b1491a..03984dddc 100644 --- a/doc/ref/scheme-translation.texi +++ b/doc/ref/scheme-translation.texi @@ -12,28 +12,32 @@ @node Emacs Lisp Support @section Emacs Lisp Support -@deffn primitive nil-car x +@deffn {Scheme Procedure} nil-car x +@deffnx {C Function} scm_nil_car (x) Return the car of @var{x}, but convert it to LISP nil if it is Scheme's end-of-list. @end deffn -@deffn primitive nil-cdr x +@deffn {Scheme Procedure} nil-cdr x +@deffnx {C Function} scm_nil_cdr (x) Return the cdr of @var{x}, but convert it to LISP nil if it is Scheme's end-of-list. @end deffn -@deffn primitive nil-cons x y +@deffn {Scheme Procedure} nil-cons x y +@deffnx {C Function} scm_nil_cons (x, y) Create a new cons cell with @var{x} as the car and @var{y} as the cdr, but convert @var{y} to Scheme's end-of-list if it is a LISP nil. @end deffn -@deffn primitive nil-eq x y +@deffn {Scheme Procedure} nil-eq x y Compare @var{x} and @var{y} and return LISP's t if they are @code{eq?}, return LISP's nil otherwise. @end deffn -@deffn primitive null x +@deffn {Scheme Procedure} null x +@deffnx {C Function} scm_null (x) Return LISP's @code{t} if @var{x} is nil in the LISP sense, return LISP's nil otherwise. @end deffn diff --git a/doc/ref/scheme-utility.texi b/doc/ref/scheme-utility.texi index 93c76bdf1..cc44f42ce 100644 --- a/doc/ref/scheme-utility.texi +++ b/doc/ref/scheme-utility.texi @@ -47,7 +47,7 @@ procedures for testing for equality are provided, which correspond to the three kinds of @dfn{sameness} defined above. @rnindex eq? -@deffn primitive eq? x y +@deffn {Scheme Procedure} eq? x y Return @code{#t} iff @var{x} references the same object as @var{y}. @code{eq?} is similar to @code{eqv?} except that in some cases it is capable of discerning distinctions finer than those detectable by @@ -55,7 +55,7 @@ capable of discerning distinctions finer than those detectable by @end deffn @rnindex eqv? -@deffn primitive eqv? x y +@deffn {Scheme Procedure} eqv? x y The @code{eqv?} procedure defines a useful equivalence relation on objects. Briefly, it returns @code{#t} if @var{x} and @var{y} should normally be regarded as the same object. This relation is left slightly open to @@ -64,7 +64,7 @@ and inexact numbers. @end deffn @rnindex equal? -@deffn primitive equal? x y +@deffn {Scheme Procedure} equal? x y Return @code{#t} iff @var{x} and @var{y} are recursively @code{eqv?} equivalent. @code{equal?} recursively compares the contents of pairs, vectors, and strings, applying @code{eqv?} on other objects such as @@ -89,23 +89,23 @@ closures than for other kinds of objects. Therefore, when manipulating a property list associated with a procedure object, use the @code{procedure} functions; otherwise, use the @code{object} functions. -@deffn primitive object-properties obj -@deffnx primitive procedure-properties obj +@deffn {Scheme Procedure} object-properties obj +@deffnx {C Function} scm_object_properties (obj) Return @var{obj}'s property list. @end deffn -@deffn primitive set-object-properties! obj alist -@deffnx primitive set-procedure-properties! obj alist +@deffn {Scheme Procedure} set-object-properties! obj alist +@deffnx {C Function} scm_set_object_properties_x (obj, alist) Set @var{obj}'s property list to @var{alist}. @end deffn -@deffn primitive object-property obj key -@deffnx primitive procedure-property obj key +@deffn {Scheme Procedure} object-property obj key +@deffnx {C Function} scm_object_property (obj, key) Return the property of @var{obj} with name @var{key}. @end deffn -@deffn primitive set-object-property! obj key value -@deffnx primitive set-procedure-property! obj key value +@deffn {Scheme Procedure} set-object-property! obj key value +@deffnx {C Function} scm_set_object_property_x (obj, key, value) In @var{obj}'s property list, set the property named @var{key} to @var{value}. @end deffn @@ -117,14 +117,16 @@ the user provides a "property table" that is possibly private.] @node Primitive Properties @section Primitive Properties -@deffn primitive primitive-make-property not_found_proc +@deffn {Scheme Procedure} primitive-make-property not_found_proc +@deffnx {C Function} scm_primitive_make_property (not_found_proc) Create a @dfn{property token} that can be used with @code{primitive-property-ref} and @code{primitive-property-set!}. See @code{primitive-property-ref} for the significance of @var{not_found_proc}. @end deffn -@deffn primitive primitive-property-ref prop obj +@deffn {Scheme Procedure} primitive-property-ref prop obj +@deffnx {C Function} scm_primitive_property_ref (prop, obj) Return the property @var{prop} of @var{obj}. When no value has yet been associated with @var{prop} and @var{obj}, call @var{not-found-proc} instead (see @code{primitive-make-property}) @@ -134,11 +136,13 @@ and use its return value. That value is also associated with default value of @var{prop}. @end deffn -@deffn primitive primitive-property-set! prop obj val +@deffn {Scheme Procedure} primitive-property-set! prop obj val +@deffnx {C Function} scm_primitive_property_set_x (prop, obj, val) Associate @var{code} with @var{prop} and @var{obj}. @end deffn -@deffn primitive primitive-property-del! prop obj +@deffn {Scheme Procedure} primitive-property-del! prop obj +@deffnx {C Function} scm_primitive_property_del_x (prop, obj) Remove any value associated with @var{prop} and @var{obj}. @end deffn @@ -161,15 +165,19 @@ The first group of procedures can be used to merge two lists (which must be already sorted on their own) and produce sorted lists containing all elements of the input lists. -@deffn primitive merge alist blist less -Take two lists @var{alist} and @var{blist} such that -@code{(sorted? alist less?)} and @code{(sorted? blist less?)} and -returns a new list in which the elements of @var{alist} and +@deffn {Scheme Procedure} merge alist blist less +@deffnx {C Function} scm_merge (alist, blist, less) +Merge two already sorted lists into one. +Given two lists @var{alist} and @var{blist}, such that +@code{(sorted? alist less?)} and @code{(sorted? blist less?)}, +return a new list in which the elements of @var{alist} and @var{blist} have been stably interleaved so that @code{(sorted? (merge alist blist less?) less?)}. +Note: this does _not_ accept vectors. @end deffn -@deffn primitive merge! alist blist less +@deffn {Scheme Procedure} merge! alist blist less +@deffnx {C Function} scm_merge_x (alist, blist, less) Takes two lists @var{alist} and @var{blist} such that @code{(sorted? alist less?)} and @code{(sorted? blist less?)} and returns a new list in which the elements of @var{alist} and @@ -189,19 +197,22 @@ If two or more elements are the same according to the comparison predicate, they are left in the same order as they appeared in the input. -@deffn primitive sorted? items less +@deffn {Scheme Procedure} sorted? items less +@deffnx {C Function} scm_sorted_p (items, less) Return @code{#t} iff @var{items} is a list or a vector such that for all 1 <= i <= m, the predicate @var{less} returns true when applied to all elements i - 1 and i @end deffn -@deffn primitive sort items less +@deffn {Scheme Procedure} sort items less +@deffnx {C Function} scm_sort (items, less) Sort the sequence @var{items}, which may be a list or a vector. @var{less} is used for comparing the sequence elements. This is not a stable sort. @end deffn -@deffn primitive sort! items less +@deffn {Scheme Procedure} sort! items less +@deffnx {C Function} scm_sort_x (items, less) Sort the sequence @var{items}, which may be a list or a vector. @var{less} is used for comparing the sequence elements. The sorting is destructive, that means that the @@ -209,13 +220,15 @@ input sequence is modified to produce the sorted result. This is not a stable sort. @end deffn -@deffn primitive stable-sort items less +@deffn {Scheme Procedure} stable-sort items less +@deffnx {C Function} scm_stable_sort (items, less) Sort the sequence @var{items}, which may be a list or a vector. @var{less} is used for comparing the sequence elements. This is a stable sort. @end deffn -@deffn primitive stable-sort! items less +@deffn {Scheme Procedure} stable-sort! items less +@deffnx {C Function} scm_stable_sort_x (items, less) Sort the sequence @var{items}, which may be a list or a vector. @var{less} is used for comparing the sequence elements. The sorting is destructive, that means that the input sequence @@ -226,19 +239,22 @@ This is a stable sort. The procedures in the last group only accept lists or vectors as input, as their names indicate. -@deffn primitive sort-list items less +@deffn {Scheme Procedure} sort-list items less +@deffnx {C Function} scm_sort_list (items, less) Sort the list @var{items}, using @var{less} for comparing the list elements. This is a stable sort. @end deffn -@deffn primitive sort-list! items less +@deffn {Scheme Procedure} sort-list! items less +@deffnx {C Function} scm_sort_list_x (items, less) Sort the list @var{items}, using @var{less} for comparing the list elements. The sorting is destructive, that means that the input list is modified to produce the sorted result. This is a stable sort. @end deffn -@deffn primitive restricted-vector-sort! vec less startpos endpos +@deffn {Scheme Procedure} restricted-vector-sort! vec less startpos endpos +@deffnx {C Function} scm_restricted_vector_sort_x (vec, less, startpos, endpos) Sort the vector @var{vec}, using @var{less} for comparing the vector elements. @var{startpos} and @var{endpos} delimit the range of the vector which gets sorted. The return value @@ -257,7 +273,8 @@ procedures for copying vectors. @code{copy-tree} can be used for these application, as it does not only copy the spine of a list, but also copies any pairs in the cars of the input lists. -@deffn primitive copy-tree obj +@deffn {Scheme Procedure} copy-tree obj +@deffnx {C Function} scm_copy_tree (obj) Recursively copy the data tree that is bound to @var{obj}, and return a pointer to the new data structure. @code{copy-tree} recurses down the contents of both pairs and vectors (since both cons cells and vector @@ -283,7 +300,8 @@ Converting an object back from the string is only possible if the object type has a read syntax and the read syntax is preserved by the printing procedure. -@deffn primitive object->string obj [printer] +@deffn {Scheme Procedure} object->string obj [printer] +@deffnx {C Function} scm_object_to_string (obj, printer) Return a Scheme string obtained by printing @var{obj}. Printing function can be specified by the optional second argument @var{printer} (default: @code{write}). diff --git a/doc/ref/script-getopt.texi b/doc/ref/script-getopt.texi index 474394af7..c71dbd205 100644 --- a/doc/ref/script-getopt.texi +++ b/doc/ref/script-getopt.texi @@ -343,7 +343,7 @@ as ordinary argument strings. @node getopt-long Reference @subsection Reference Documentation for @code{getopt-long} -@deffn procedure getopt-long args grammar +@deffn {Scheme Procedure} getopt-long args grammar Parse the command line given in @var{args} (which must be a list of strings) according to the option specification @var{grammar}. @@ -416,7 +416,7 @@ An option predicate fails. @node option-ref Reference @subsection Reference Documentation for @code{option-ref} -@deffn procedure option-ref options key default +@deffn {Scheme Procedure} option-ref options key default Search @var{options} for a command line option named @var{key} and return its value, if found. If the option has no value, but was given, return @code{#t}. If the option was not given, return @var{default}. diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi index c620050f0..b115068a0 100644 --- a/doc/ref/srfi-modules.texi +++ b/doc/ref/srfi-modules.texi @@ -199,24 +199,24 @@ processing procedure, you should also have a look at the sections New lists can be constructed by calling one of the following procedures. -@deffn procedure xcons d a +@deffn {Scheme Procedure} xcons d a Like @code{cons}, but with interchanged arguments. Useful mostly when passed to higher-order procedures. @end deffn -@deffn procedure list-tabulate n init-proc +@deffn {Scheme Procedure} list-tabulate n init-proc Return an @var{n}-element list, where each list element is produced by applying the procedure @var{init-proc} to the corresponding list index. The order in which @var{init-proc} is applied to the indices is not specified. @end deffn -@deffn procedure circular-list elt1 elt2 @dots{} +@deffn {Scheme Procedure} circular-list elt1 elt2 @dots{} Return a circular list containing the given arguments @var{elt1} @var{elt2} @dots{}. @end deffn -@deffn procedure iota count [start step] +@deffn {Scheme Procedure} iota count [start step] Return a list containing @var{count} elements, where each element is calculated as follows: @@ -233,23 +233,23 @@ calculated as follows: The procedures in this section test specific properties of lists. -@deffn procedure proper-list? obj +@deffn {Scheme Procedure} proper-list? obj Return @code{#t} if @var{obj} is a proper list, that is a finite list, terminated with the empty list. Otherwise, return @code{#f}. @end deffn -@deffn procedure circular-list? obj +@deffn {Scheme Procedure} circular-list? obj Return @code{#t} if @var{obj} is a circular list, otherwise return @code{#f}. @end deffn -@deffn procedure dotted-list? obj +@deffn {Scheme Procedure} dotted-list? obj Return @code{#t} if @var{obj} is a dotted list, return @code{#f} otherwise. A dotted list is a finite list which is not terminated by the empty list, but some other value. @end deffn -@deffn procedure null-list? lst +@deffn {Scheme Procedure} null-list? lst Return @code{#t} if @var{lst} is the empty list @code{()}, @code{#f} otherwise. If something else than a proper or circular list is passed as @var{lst}, an error is signalled. This procedure is recommented @@ -257,14 +257,14 @@ for checking for the end of a list in contexts where dotted lists are not allowed. @end deffn -@deffn procedure not-pair? obj +@deffn {Scheme Procedure} not-pair? obj Return @code{#t} is @var{obj} is not a pair, @code{#f} otherwise. This is shorthand notation @code{(not (pair? @var{obj}))} and is supposed to be used for end-of-list checking in contexts where dotted lists are allowed. @end deffn -@deffn procedure list= elt= list1 @dots{} +@deffn {Scheme Procedure} list= elt= list1 @dots{} Return @code{#t} if all argument lists are equal, @code{#f} otherwise. List equality is determined by testing whether all lists have the same length and the corresponding elements are equal in the sense of the @@ -278,42 +278,42 @@ equality predicate @var{elt=}. If no or only one list is given, @c FIXME::martin: Review me! -@deffn procedure first pair -@deffnx procedure second pair -@deffnx procedure third pair -@deffnx procedure fourth pair -@deffnx procedure fifth pair -@deffnx procedure sixth pair -@deffnx procedure seventh pair -@deffnx procedure eighth pair -@deffnx procedure ninth pair -@deffnx procedure tenth pair +@deffn {Scheme Procedure} first pair +@deffnx {Scheme Procedure} second pair +@deffnx {Scheme Procedure} third pair +@deffnx {Scheme Procedure} fourth pair +@deffnx {Scheme Procedure} fifth pair +@deffnx {Scheme Procedure} sixth pair +@deffnx {Scheme Procedure} seventh pair +@deffnx {Scheme Procedure} eighth pair +@deffnx {Scheme Procedure} ninth pair +@deffnx {Scheme Procedure} tenth pair These are synonyms for @code{car}, @code{cadr}, @code{caddr}, @dots{}. @end deffn -@deffn procedure car+cdr pair +@deffn {Scheme Procedure} car+cdr pair Return two values, the @sc{car} and the @sc{cdr} of @var{pair}. @end deffn -@deffn procedure take lst i -@deffnx procedure take! lst i +@deffn {Scheme Procedure} take lst i +@deffnx {Scheme Procedure} take! lst i Return a list containing the first @var{i} elements of @var{lst}. @code{take!} may modify the structure of the argument list @var{lst} in order to produce the result. @end deffn -@deffn procedure drop lst i +@deffn {Scheme Procedure} drop lst i Return a list containing all but the first @var{i} elements of @var{lst}. @end deffn -@deffn procedure take-right lst i +@deffn {Scheme Procedure} take-right lst i Return the a list containing the @var{i} last elements of @var{lst}. @end deffn -@deffn procedure drop-right lst i -@deffnx procedure drop-right! lst i +@deffn {Scheme Procedure} drop-right lst i +@deffnx {Scheme Procedure} drop-right! lst i Return the a list containing all but the @var{i} last elements of @var{lst}. @@ -321,8 +321,8 @@ Return the a list containing all but the @var{i} last elements of @var{lst} in order to produce the result. @end deffn -@deffn procedure split-at lst i -@deffnx procedure split-at! lst i +@deffn {Scheme Procedure} split-at lst i +@deffnx {Scheme Procedure} split-at! lst i Return two values, a list containing the first @var{i} elements of the list @var{lst} and a list containing the remaining elements. @@ -330,7 +330,7 @@ list @var{lst} and a list containing the remaining elements. @var{lst} in order to produce the result. @end deffn -@deffn procedure last lst +@deffn {Scheme Procedure} last lst Return the last element of the non-empty, finite list @var{lst}. @end deffn @@ -340,21 +340,21 @@ Return the last element of the non-empty, finite list @var{lst}. @c FIXME::martin: Review me! -@deffn procedure length+ lst +@deffn {Scheme Procedure} length+ lst Return the length of the argument list @var{lst}. When @var{lst} is a circular list, @code{#f} is returned. @end deffn -@deffn procedure concatenate list-of-lists -@deffnx procedure concatenate! list-of-lists +@deffn {Scheme Procedure} concatenate list-of-lists +@deffnx {Scheme Procedure} concatenate! list-of-lists Construct a list by appending all lists in @var{list-of-lists}. @code{concatenate!} may modify the structure of the given lists in order to produce the result. @end deffn -@deffn procedure append-reverse rev-head tail -@deffnx procedure append-reverse! rev-head tail +@deffn {Scheme Procedure} append-reverse rev-head tail +@deffnx {Scheme Procedure} append-reverse! rev-head tail Reverse @var{rev-head}, append @var{tail} and return the result. This is equivalent to @code{(append (reverse @var{rev-head}) @var{tail})}, but more efficient. @@ -363,18 +363,18 @@ but more efficient. the result. @end deffn -@deffn procedure zip lst1 lst2 @dots{} +@deffn {Scheme Procedure} zip lst1 lst2 @dots{} Return a list as long as the shortest of the argument lists, where each element is a list. The first list contains the first elements of the argument lists, the second list contains the second elements, and so on. @end deffn -@deffn procedure unzip1 lst -@deffnx procedure unzip2 lst -@deffnx procedure unzip3 lst -@deffnx procedure unzip4 lst -@deffnx procedure unzip5 lst +@deffn {Scheme Procedure} unzip1 lst +@deffnx {Scheme Procedure} unzip2 lst +@deffnx {Scheme Procedure} unzip3 lst +@deffnx {Scheme Procedure} unzip4 lst +@deffnx {Scheme Procedure} unzip5 lst @code{unzip1} takes a list of lists, and returns a list containing the first elements of each list, @code{unzip2} returns two lists, the first containing the first elements of each lists and the second @@ -387,7 +387,7 @@ containing the second elements of each lists, and so on. @c FIXME::martin: Review me! -@deffn procedure fold kons knil lst1 lst2 @dots{} +@deffn {Scheme Procedure} fold kons knil lst1 lst2 @dots{} Fold the procedure @var{kons} across all elements of @var{lst1}, @var{lst2}, @dots{}. Produce the result of @@ -398,7 +398,7 @@ if @var{enm} are the elements of the lists @var{lst1}, @var{lst2}, @dots{}. @end deffn -@deffn procedure fold-right kons knil lst1 lst2 @dots{} +@deffn {Scheme Procedure} fold-right kons knil lst1 lst2 @dots{} Similar to @code{fold}, but applies @var{kons} in right-to-left order to the list elements, that is: @@ -406,27 +406,27 @@ to the list elements, that is: @var{e22} @dots{} (@var{kons} @var{en1} @var{en2} @var{knil})))}, @end deffn -@deffn procedure pair-fold kons knil lst1 lst2 @dots{} +@deffn {Scheme Procedure} pair-fold kons knil lst1 lst2 @dots{} Like @code{fold}, but apply @var{kons} to the pairs of the list instead of the list elements. @end deffn -@deffn procedure pair-fold-right kons knil lst1 lst2 @dots{} +@deffn {Scheme Procedure} pair-fold-right kons knil lst1 lst2 @dots{} Like @code{fold-right}, but apply @var{kons} to the pairs of the list instead of the list elements. @end deffn -@deffn procedure reduce f ridentity lst +@deffn {Scheme Procedure} reduce f ridentity lst @code{reduce} is a variant of @code{reduce}. If @var{lst} is @code{()}, @var{ridentity} is returned. Otherwise, @code{(fold (car @var{lst}) (cdr @var{lst}))} is returned. @end deffn -@deffn procedure reduce-right f ridentity lst +@deffn {Scheme Procedure} reduce-right f ridentity lst This is the @code{fold-right} variant of @var{reduce}. @end deffn -@deffn procedure unfold p f g seed [tail-gen] +@deffn {Scheme Procedure} unfold p f g seed [tail-gen] @code{unfold} is defined as follows: @lisp @@ -458,7 +458,7 @@ elements by @var{f}. These elements are put into a list in left-to-right order, and @var{p} tells when to stop unfolding. @end deffn -@deffn procedure unfold-right p f g seed [tail] +@deffn {Scheme Procedure} unfold-right p f g seed [tail] Construct a list with the following loop. @lisp @@ -487,7 +487,7 @@ Creates the tail of the list; defaults to @code{(lambda (x) '())}. @end deffn -@deffn procedure map f lst1 lst2 @dots{} +@deffn {Scheme Procedure} map f lst1 lst2 @dots{} Map the procedure over the list(s) @var{lst1}, @var{lst2}, @dots{} and return a list containing the results of the procedure applications. This procedure is extended with respect to R5RS, because the argument @@ -496,7 +496,7 @@ length as the shortest argument lists. The order in which @var{f} will be applied to the list element(s) is not specified. @end deffn -@deffn procedure for-each f lst1 lst2 @dots{} +@deffn {Scheme Procedure} for-each f lst1 lst2 @dots{} Apply the procedure @var{f} to each pair of corresponding elements of the list(s) @var{lst1}, @var{lst2}, @dots{}. The return value is not specified. This procedure is extended with respect to R5RS, because @@ -506,8 +506,8 @@ be applied to tge list elements in left-to-right order. @end deffn -@deffn procedure append-map f lst1 lst2 @dots{} -@deffnx procedure append-map! f lst1 lst2 @dots{} +@deffn {Scheme Procedure} append-map f lst1 lst2 @dots{} +@deffnx {Scheme Procedure} append-map! f lst1 lst2 @dots{} Equivalent to @lisp @@ -530,7 +530,7 @@ The dynamic order in which the various applications of @var{f} are made is not specified. @end deffn -@deffn procedure map! f lst1 lst2 @dots{} +@deffn {Scheme Procedure} map! f lst1 lst2 @dots{} Linear-update variant of @code{map} -- @code{map!} is allowed, but not required, to alter the cons cells of @var{lst1} to construct the result list. @@ -540,13 +540,13 @@ made is not specified. In the n-ary case, @var{lst2}, @var{lst3}, @dots{} must have at least as many elements as @var{lst1}. @end deffn -@deffn procedure pair-for-each f lst1 lst2 @dots{} +@deffn {Scheme Procedure} pair-for-each f lst1 lst2 @dots{} Like @code{for-each}, but applies the procedure @var{f} to the pairs from which the argument lists are constructed, instead of the list elements. The return value is not specified. @end deffn -@deffn procedure filter-map f lst1 lst2 @dots{} +@deffn {Scheme Procedure} filter-map f lst1 lst2 @dots{} Like @code{map}, but only results from the applications of @var{f} which are true are saved in the result list. @end deffn @@ -562,8 +562,8 @@ specific condition. Partitioning a list means to make two groups of list elements, one which contains the elements satisfying a condition, and the other for the elements which don't. -@deffn procedure filter pred lst -@deffnx procedure filter! pred lst +@deffn {Scheme Procedure} filter pred lst +@deffnx {Scheme Procedure} filter! pred lst Return a list containing all elements from @var{lst} which satisfy the predicate @var{pred}. The elements in the result list have the same order as in @var{lst}. The order in which @var{pred} is applied to @@ -572,8 +572,8 @@ the list elements is not specified. @code{filter!} is allowed, but not required to modify the structure of @end deffn -@deffn procedure partition pred lst -@deffnx procedure partition! pred lst +@deffn {Scheme Procedure} partition pred lst +@deffnx {Scheme Procedure} partition! pred lst Return two lists, one containing all elements from @var{lst} which satisfy the predicate @var{pred}, and one list containing the elements which do not satisfy the predicated. The elements in the result lists @@ -584,8 +584,8 @@ applied to the list elements is not specified. the input list. @end deffn -@deffn procedure remove pred lst -@deffnx procedure remove! pred lst +@deffn {Scheme Procedure} remove pred lst +@deffnx {Scheme Procedure} remove! pred lst Return a list containing all elements from @var{lst} which do not satisfy the predicate @var{pred}. The elements in the result list have the same order as in @var{lst}. The order in which @var{pred} is @@ -605,18 +605,18 @@ The procedures for searching elements in lists either accept a predicate or a comparison object for determining which elements are to be searched. -@deffn procedure find pred lst +@deffn {Scheme Procedure} find pred lst Return the first element of @var{lst} which satisfies the predicate @var{pred} and @code{#f} if no such element is found. @end deffn -@deffn procedure find-tail pred lst +@deffn {Scheme Procedure} find-tail pred lst Return the first pair of @var{lst} whose @sc{car} satisfies the predicate @var{pred} and @code{#f} if no such element is found. @end deffn -@deffn procedure take-while pred lst -@deffnx procedure take-while! pred lst +@deffn {Scheme Procedure} take-while pred lst +@deffnx {Scheme Procedure} take-while! pred lst Return the longest initial prefix of @var{lst} whose elements all satisfy the predicate @var{pred}. @@ -624,15 +624,15 @@ satisfy the predicate @var{pred}. list while producing the result. @end deffn -@deffn procedure drop-while pred lst +@deffn {Scheme Procedure} drop-while pred lst Drop the longest initial prefix of @var{lst} whose elements all satisfy the predicate @var{pred}. @end deffn -@deffn procedure span pred lst -@deffnx procedure span! pred lst -@deffnx procedure break pred lst -@deffnx procedure break! pred lst +@deffn {Scheme Procedure} span pred lst +@deffnx {Scheme Procedure} span! pred lst +@deffnx {Scheme Procedure} break pred lst +@deffnx {Scheme Procedure} break! pred lst @code{span} splits the list @var{lst} into the longest initial prefix whose elements all satisfy the predicate @var{pred}, and the remaining tail. @code{break} inverts the sense of the predicate. @@ -642,25 +642,25 @@ the structure of the input list @var{lst} in order to produce the result. @end deffn -@deffn procedure any pred lst1 lst2 @dots{} +@deffn {Scheme Procedure} any pred lst1 lst2 @dots{} Apply @var{pred} across the lists and return a true value if the predicate returns true for any of the list elements(s); return @code{#f} otherwise. The true value returned is always the result of the first succesful application of @var{pred}. @end deffn -@deffn procedure every pred lst1 lst2 @dots{} +@deffn {Scheme Procedure} every pred lst1 lst2 @dots{} Apply @var{pred} across the lists and return a true value if the predicate returns true for every of the list elements(s); return @code{#f} otherwise. The true value returned is always the result of the final succesful application of @var{pred}. @end deffn -@deffn procedure list-index pred lst1 lst2 @dots{} +@deffn {Scheme Procedure} list-index pred lst1 lst2 @dots{} Return the index of the leftmost element that satisfies @var{pred}. @end deffn -@deffn procedure member x lst [=] +@deffn {Scheme Procedure} member x lst [=] Return the first sublist of @var{lst} whose @sc{car} is equal to @var{x}. If @var{x} does no appear in @var{lst}, return @code{#f}. Equality is determined by the equality predicate @var{=}, or @@ -677,8 +677,8 @@ The procedures for deleting elements from a list either accept a predicate or a comparison object for determining which elements are to be removed. -@deffn procedure delete x lst [=] -@deffnx procedure delete! x lst [=] +@deffn {Scheme Procedure} delete x lst [=] +@deffnx {Scheme Procedure} delete! x lst [=] Return a list containing all elements from @var{lst}, but without the elements equal to @var{x}. Equality is determined by the equality predicate @var{=}, which defaults to @code{equal?} if not given. @@ -687,8 +687,8 @@ predicate @var{=}, which defaults to @code{equal?} if not given. the argument list in order to produce the result. @end deffn -@deffn procedure delete-duplicates lst [=] -@deffnx procedure delete-duplicates! lst [=] +@deffn {Scheme Procedure} delete-duplicates lst [=] +@deffnx {Scheme Procedure} delete-duplicates! lst [=] Return a list containing all elements from @var{lst}, but without duplicate elements. Equality of elements is determined by the equality predicate @var{=}, which defaults to @code{equal?} if not @@ -708,13 +708,13 @@ Association lists are described in detail in section @ref{Association Lists}. The present section only documents the additional procedures for dealing with association lists defined by SRFI-1. -@deffn procedure assoc key alist [=] +@deffn {Scheme Procedure} assoc key alist [=] Return the pair from @var{alist} which matches @var{key}. Equality is determined by @var{=}, which defaults to @code{equal?} if not given. @var{alist} must be an association lists---a list of pairs. @end deffn -@deffn procedure alist-cons key datum alist +@deffn {Scheme Procedure} alist-cons key datum alist Equivalent to @lisp @@ -725,13 +725,13 @@ This procedure is used to coons a new pair onto an existing association list. @end deffn -@deffn procedure alist-copy alist +@deffn {Scheme Procedure} alist-copy alist Return a newly allocated copy of @var{alist}, that means that the spine of the list as well as the pairs are copied. @end deffn -@deffn procedure alist-delete key alist [=] -@deffnx procedure alist-delete! key alist [=] +@deffn {Scheme Procedure} alist-delete key alist [=] +@deffnx {Scheme Procedure} alist-delete! key alist [=] Return a list containing the pairs of @var{alist}, but without the pairs whose @sc{cars} are equal to @var{key}. Equality is determined by @var{=}, which defaults to @code{equal?} if not given. @@ -759,43 +759,43 @@ All these procedures accept an equality predicate as the first argument. This predicate is used for testing the objects in the list sets for sameness. -@deffn procedure lset<= = list1 @dots{} +@deffn {Scheme Procedure} lset<= = list1 @dots{} Return @code{#t} if every @var{listi} is a subset of @var{listi+1}, otherwise return @code{#f}. Returns @code{#t} if called with less than two arguments. @var{=} is used for testing element equality. @end deffn -@deffn procedure lset= = list1 list2 @dots{} +@deffn {Scheme Procedure} lset= = list1 list2 @dots{} Return @code{#t} if all argument lists are equal. @var{=} is used for testing element equality. @end deffn -@deffn procedure lset-adjoin = list elt1 @dots{} -@deffnx procedure lset-adjoin! = list elt1 @dots{} +@deffn {Scheme Procedure} lset-adjoin = list elt1 @dots{} +@deffnx {Scheme Procedure} lset-adjoin! = list elt1 @dots{} Add all @var{elts} to the list @var{list}, suppressing duplicates and return the resulting list. @code{lset-adjoin!} is allowed, but not required to modify its first argument. @var{=} is used for testing element equality. @end deffn -@deffn procedure lset-union = list1 @dots{} -@deffnx procedure lset-union! = list1 @dots{} +@deffn {Scheme Procedure} lset-union = list1 @dots{} +@deffnx {Scheme Procedure} lset-union! = list1 @dots{} Return the union of all argument list sets. The union is the set of all elements which appear in any of the argument sets. @code{lset-union!} is allowed, but not required to modify its first argument. @var{=} is used for testing element equality. @end deffn -@deffn procedure lset-intersection = list1 list2 @dots{} -@deffnx procedure lset-intersection! = list1 list2 @dots{} +@deffn {Scheme Procedure} lset-intersection = list1 list2 @dots{} +@deffnx {Scheme Procedure} lset-intersection! = list1 list2 @dots{} Return the intersection of all argument list sets. The intersection is the set containing all elements which appear in all argument sets. @code{lset-intersection!} is allowed, but not required to modify its first argument. @var{=} is used for testing element equality. @end deffn -@deffn procedure lset-difference = list1 list2 @dots{} -@deffnx procedure lset-difference! = list1 list2 @dots{} +@deffn {Scheme Procedure} lset-difference = list1 list2 @dots{} +@deffnx {Scheme Procedure} lset-difference! = list1 list2 @dots{} Return the difference of all argument list sets. The difference is the the set containing all elements of the first list which do not appear in the other lists. @code{lset-difference!} is allowed, but @@ -803,8 +803,8 @@ not required to modify its first argument. @var{=} is used for testing element equality. @end deffn -@deffn procedure lset-xor = list1 @dots{} -@deffnx procedure lset-xor! = list1 @dots{} +@deffn {Scheme Procedure} lset-xor = list1 @dots{} +@deffnx {Scheme Procedure} lset-xor! = list1 @dots{} Return the set containing all elements which appear in the first argument list set, but not in the second; or, more generally: which appear in an odd number of sets. @code{lset-xor!} is allowed, but @@ -812,8 +812,8 @@ not required to modify its first argument. @var{=} is used for testing element equality. @end deffn -@deffn procedure lset-diff+intersection = list1 list2 @dots{} -@deffnx procedure lset-diff+intersection! = list1 list2 @dots{} +@deffn {Scheme Procedure} lset-diff+intersection = list1 list2 @dots{} +@deffnx {Scheme Procedure} lset-diff+intersection! = list1 list2 @dots{} Return two values, the difference and the intersection of the argument list sets. This works like a combination of @code{lset-difference} and @code{lset-intersection}, but is more efficient. @@ -939,42 +939,42 @@ For example, you can use the procedures @code{u8vector?}, @code{make-s8vector}, @code{u16vector}, @code{u32vector-length}, @code{s64vector-ref}, @code{f32vector-set!} or @code{f64vector->list}. -@deffn primitive TAGvector? obj +@deffn {Scheme Procedure} TAGvector? obj Return @code{#t} if @var{obj} is a homogeneous numeric vector of type @code{TAG}. @end deffn -@deffn primitive make-TAGvector n [value] +@deffn {Scheme Procedure} make-TAGvector n [value] Create a newly allocated homogeneous numeric vector of type @code{TAG}, which can hold @var{n} elements. If @var{value} is given, the vector is initialized with the value, otherwise, the contents of the returned vector is not specified. @end deffn -@deffn primitive TAGvector value1 @dots{} +@deffn {Scheme Procedure} TAGvector value1 @dots{} Create a newly allocated homogeneous numeric vector of type @code{TAG}. The returned vector is as long as the number of arguments given, and is initialized with the argument values. @end deffn -@deffn primitive TAGvector-length TAGvec +@deffn {Scheme Procedure} TAGvector-length TAGvec Return the number of elements in @var{TAGvec}. @end deffn -@deffn primitive TAGvector-ref TAGvec i +@deffn {Scheme Procedure} TAGvector-ref TAGvec i Return the element at index @var{i} in @var{TAGvec}. @end deffn -@deffn primitive TAGvector-ref TAGvec i value +@deffn {Scheme Procedure} TAGvector-ref TAGvec i value Set the element at index @var{i} in @var{TAGvec} to @var{value}. The return value is not specified. @end deffn -@deffn primitive TAGvector->list TAGvec +@deffn {Scheme Procedure} TAGvector->list TAGvec Return a newly allocated list holding all elements of @var{TAGvec}. @end deffn -@deffn primitive list->TAGvector lst +@deffn {Scheme Procedure} list->TAGvector lst Return a newly allocated homogeneous numeric vector of type @code{TAG}, initialized with the elements of the list @var{lst}. @end deffn @@ -1079,7 +1079,7 @@ Example: Please note the quote before the @code{#,(file ...)} expression. This is necessary because ports are not self-evaluating in Guile. -@deffn procedure define-reader-ctor symbol proc +@deffn {Scheme Procedure} define-reader-ctor symbol proc Define @var{proc} as the reader constructor for hash-comma forms with a tag @var{symbol}. @var{proc} will be applied to the datum(s) following the tag in the hash-comma expression after the complete form has been @@ -1196,7 +1196,7 @@ In addition to the primitives @code{string?} and @code{string-null?}, which are already in the Guile core, the string predicates @code{string-any} and @code{string-every} are defined by SRFI-13. -@deffn primitive string-any pred s [start end] +@deffn {Scheme Procedure} string-any pred s [start end] Check if the predicate @var{pred} is true for any character in the string @var{s}, proceeding from left (index @var{start}) to right (index @var{end}). If @code{string-any} returns true, @@ -1204,7 +1204,7 @@ the returned true value is the one produced by the first successful application of @var{pred}. @end deffn -@deffn primitive string-every pred s [start end] +@deffn {Scheme Procedure} string-every pred s [start end] Check if the predicate @var{pred} is true for every character in the string @var{s}, proceeding from left (index @var{start}) to right (index @var{end}). If @code{string-every} returns @@ -1222,7 +1222,7 @@ SRFI-13 defines several procedures for constructing new strings. In addition to @code{make-string} and @code{string} (available in the Guile core library), the procedure @code{string-tabulate} does exist. -@deffn primitive string-tabulate proc len +@deffn {Scheme Procedure} string-tabulate proc len @var{proc} is an integer->char procedure. Construct a string of size @var{len} by applying @var{proc} to each index to produce the corresponding string element. The order in which @@ -1241,11 +1241,11 @@ The Guile core already contains the procedure @code{list->string} for converting a list of characters into a string (@pxref{List/String Conversion}). -@deffn primitive string->list str [start end] +@deffn {Scheme Procedure} string->list str [start end] Convert the string @var{str} into a list of characters. @end deffn -@deffn primitive reverse-list->string chrs +@deffn {Scheme Procedure} reverse-list->string chrs An efficient implementation of @code{(compose string->list reverse)}: @@ -1254,7 +1254,7 @@ reverse)}: @end smalllisp @end deffn -@deffn primitive string-join ls [delimiter grammar] +@deffn {Scheme Procedure} string-join ls [delimiter grammar] Append the string in the string list @var{ls}, using the string @var{delim} as a delimiter between the elements of @var{ls}. @var{grammar} is a symbol which specifies how the delimiter is @@ -1294,18 +1294,18 @@ Additional selector procedures are documented in the Strings section @code{string-copy} is also available in core Guile, but this version accepts additional start/end indices. -@deffn primitive string-copy str [start end] +@deffn {Scheme Procedure} string-copy str [start end] Return a freshly allocated copy of the string @var{str}. If given, @var{start} and @var{end} delimit the portion of @var{str} which is copied. @end deffn -@deffn primitive substring/shared str start [end] +@deffn {Scheme Procedure} substring/shared str start [end] Like @code{substring}, but the result may share memory with the argument @var{str}. @end deffn -@deffn primitive string-copy! target tstart s [start end] +@deffn {Scheme Procedure} string-copy! target tstart s [start end] Copy the sequence of characters from index range [@var{start}, @var{end}) in string @var{s} to string @var{target}, beginning at index @var{tstart}. The characters are copied left-to-right @@ -1315,27 +1315,27 @@ error if the copy operation runs off the end of the target string. @end deffn -@deffn primitive string-take s n -@deffnx primitive string-take-right s n +@deffn {Scheme Procedure} string-take s n +@deffnx {Scheme Procedure} string-take-right s n Return the @var{n} first/last characters of @var{s}. @end deffn -@deffn primitive string-drop s n -@deffnx primitive string-drop-right s n +@deffn {Scheme Procedure} string-drop s n +@deffnx {Scheme Procedure} string-drop-right s n Return all but the first/last @var{n} characters of @var{s}. @end deffn -@deffn primitive string-pad s len [chr start end] -@deffnx primitive string-pad-right s len [chr start end] +@deffn {Scheme Procedure} string-pad s len [chr start end] +@deffnx {Scheme Procedure} string-pad-right s len [chr start end] Take that characters from @var{start} to @var{end} from the string @var{s} and return a new string, right(left)-padded by the character @var{chr} to length @var{len}. If the resulting string is longer than @var{len}, it is truncated on the right (left). @end deffn -@deffn primitive string-trim s [char_pred start end] -@deffnx primitive string-trim-right s [char_pred start end] -@deffnx primitive string-trim-both s [char_pred start end] +@deffn {Scheme Procedure} string-trim s [char_pred start end] +@deffnx {Scheme Procedure} string-trim-right s [char_pred start end] +@deffnx {Scheme Procedure} string-trim-both s [char_pred start end] Trim @var{s} by skipping over all characters on the left/right/both sides of the string that satisfy the parameter @var{char_pred}: @@ -1368,7 +1368,7 @@ of the same name in the Guile core. The second modification procedure @code{string-set!} is documented in the Strings section (@pxref{String Modification}). -@deffn primitive string-fill! str chr [start end] +@deffn {Scheme Procedure} string-fill! str chr [start end] Stores @var{chr} in every element of the given @var{str} and returns an unspecified value. @end deffn @@ -1387,8 +1387,8 @@ index in the case of a true return value. @code{string-hash} and @code{string-hash-ci} are for calculating hash values for strings, useful for implementing fast lookup mechanisms. -@deffn primitive string-compare s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2] -@deffnx primitive string-compare-ci s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2] +@deffn {Scheme Procedure} string-compare s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-compare-ci s1 s2 proc_lt proc_eq proc_gt [start1 end1 start2 end2] Apply @var{proc_lt}, @var{proc_eq}, @var{proc_gt} to the mismatch index, depending upon whether @var{s1} is less than, equal to, or greater than @var{s2}. The mismatch index is the @@ -1398,30 +1398,30 @@ largest index @var{i} such that for every 0 <= @var{j} < character comparison is done case-insensitively. @end deffn -@deffn primitive string= s1 s2 [start1 end1 start2 end2] -@deffnx primitive string<> s1 s2 [start1 end1 start2 end2] -@deffnx primitive string< s1 s2 [start1 end1 start2 end2] -@deffnx primitive string> s1 s2 [start1 end1 start2 end2] -@deffnx primitive string<= s1 s2 [start1 end1 start2 end2] -@deffnx primitive string>= s1 s2 [start1 end1 start2 end2] +@deffn {Scheme Procedure} string= s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string<> s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string< s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string> s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string<= s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string>= s1 s2 [start1 end1 start2 end2] Compare @var{s1} and @var{s2} and return @code{#f} if the predicate fails. Otherwise, the mismatch index is returned (or @var{end1} in the case of @code{string=}. @end deffn -@deffn primitive string-ci= s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-ci<> s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-ci< s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-ci> s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-ci<= s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-ci>= s1 s2 [start1 end1 start2 end2] +@deffn {Scheme Procedure} string-ci= s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-ci<> s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-ci< s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-ci> s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-ci<= s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-ci>= s1 s2 [start1 end1 start2 end2] Compare @var{s1} and @var{s2} and return @code{#f} if the predicate fails. Otherwise, the mismatch index is returned (or @var{end1} in the case of @code{string=}. These are the case-insensitive variants. @end deffn -@deffn primitive string-hash s [bound start end] -@deffnx primitive string-hash-ci s [bound start end] +@deffn {Scheme Procedure} string-hash s [bound start end] +@deffnx {Scheme Procedure} string-hash-ci s [bound start end] Return a hash value of the string @var{s} in the range 0 @dots{} @var{bound} - 1. @code{string-hash-ci} is the case-insensitive variant. @end deffn @@ -1436,19 +1436,19 @@ Using these procedures you can determine whether a given string is a prefix or suffix of another string or how long a common prefix/suffix is. -@deffn primitive string-prefix-length s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-prefix-length-ci s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-suffix-length s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-suffix-length-ci s1 s2 [start1 end1 start2 end2] +@deffn {Scheme Procedure} string-prefix-length s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-prefix-length-ci s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-suffix-length s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-suffix-length-ci s1 s2 [start1 end1 start2 end2] Return the length of the longest common prefix/suffix of the two strings. @code{string-prefix-length-ci} and @code{string-suffix-length-ci} are the case-insensitive variants. @end deffn -@deffn primitive string-prefix? s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-prefix-ci? s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-suffix? s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-suffix-ci? s1 s2 [start1 end1 start2 end2] +@deffn {Scheme Procedure} string-prefix? s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-prefix-ci? s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-suffix? s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-suffix-ci? s1 s2 [start1 end1 start2 end2] Is @var{s1} a prefix/suffix of @var{s2}. @code{string-prefix-ci?} and @code{string-suffix-ci?} are the case-insensitive variants. @end deffn @@ -1462,8 +1462,8 @@ Is @var{s1} a prefix/suffix of @var{s2}. @code{string-prefix-ci?} and Use these procedures to find out whether a string contains a given character or a given substring, or a character from a set of characters. -@deffn primitive string-index s char_pred [start end] -@deffnx primitive string-index-right s char_pred [start end] +@deffn {Scheme Procedure} string-index s char_pred [start end] +@deffnx {Scheme Procedure} string-index-right s char_pred [start end] Search through the string @var{s} from left to right (right to left), returning the index of the first (last) occurence of a character which @@ -1480,8 +1480,8 @@ is in the set @var{char_pred}, if it is a character set. @end itemize @end deffn -@deffn primitive string-skip s char_pred [start end] -@deffnx primitive string-skip-right s char_pred [start end] +@deffn {Scheme Procedure} string-skip s char_pred [start end] +@deffnx {Scheme Procedure} string-skip-right s char_pred [start end] Search through the string @var{s} from left to right (right to left), returning the index of the first (last) occurence of a character which @@ -1498,7 +1498,7 @@ is not in the set if @var{char_pred} is a character set. @end itemize @end deffn -@deffn primitive string-count s char_pred [start end] +@deffn {Scheme Procedure} string-count s char_pred [start end] Return the count of the number of characters in the string @var{s} which @@ -1514,8 +1514,8 @@ is in the set @var{char_pred}, if it is a character set. @end itemize @end deffn -@deffn primitive string-contains s1 s2 [start1 end1 start2 end2] -@deffnx primitive string-contains-ci s1 s2 [start1 end1 start2 end2] +@deffn {Scheme Procedure} string-contains s1 s2 [start1 end1 start2 end2] +@deffnx {Scheme Procedure} string-contains-ci s1 s2 [start1 end1 start2 end2] Does string @var{s1} contain string @var{s2}? Return the index in @var{s1} where @var{s2} occurs as a substring, or false. The optional start/end indices restrict the operation to the @@ -1534,20 +1534,20 @@ These procedures convert the alphabetic case of strings. They are similar to the procedures in the Guile core, but are extended to handle optional start/end indices. -@deffn primitive string-upcase s [start end] -@deffnx primitive string-upcase! s [start end] +@deffn {Scheme Procedure} string-upcase s [start end] +@deffnx {Scheme Procedure} string-upcase! s [start end] Upcase every character in @var{s}. @code{string-upcase!} is the side-effecting variant. @end deffn -@deffn primitive string-downcase s [start end] -@deffnx primitive string-downcase! s [start end] +@deffn {Scheme Procedure} string-downcase s [start end] +@deffnx {Scheme Procedure} string-downcase! s [start end] Downcase every character in @var{s}. @code{string-downcase!} is the side-effecting variant. @end deffn -@deffn primitive string-titlecase s [start end] -@deffnx primitive string-titlecase! s [start end] +@deffn {Scheme Procedure} string-titlecase s [start end] +@deffnx {Scheme Procedure} string-titlecase! s [start end] Upcase every first character in every word in @var{s}, downcase the other characters. @code{string-titlecase!} is the side-effecting variant. @@ -1562,8 +1562,8 @@ variant. One appending procedure, @code{string-append} is the same in R5RS and in SRFI-13, so it is not redefined. -@deffn primitive string-reverse str [start end] -@deffnx primitive string-reverse! str [start end] +@deffn {Scheme Procedure} string-reverse str [start end] +@deffnx {Scheme Procedure} string-reverse! str [start end] Reverse the string @var{str}. The optional arguments @var{start} and @var{end} delimit the region of @var{str} to operate on. @@ -1572,23 +1572,23 @@ operate on. unspecified value. @end deffn -@deffn primitive string-append/shared ls @dots{} +@deffn {Scheme Procedure} string-append/shared ls @dots{} Like @code{string-append}, but the result may share memory with the argument strings. @end deffn -@deffn primitive string-concatenate ls +@deffn {Scheme Procedure} string-concatenate ls Append the elements of @var{ls} (which must be strings) together into a single string. Guaranteed to return a freshly allocated string. @end deffn -@deffn primitive string-concatenate/shared ls +@deffn {Scheme Procedure} string-concatenate/shared ls Like @code{string-concatenate}, but the result may share memory with the strings in the list @var{ls}. @end deffn -@deffn primitive string-concatenate-reverse ls final_string end +@deffn {Scheme Procedure} string-concatenate-reverse ls final_string end Without optional arguments, this procedure is equivalent to @smalllisp @@ -1604,7 +1604,7 @@ is given, only the characters of @var{final_string} up to index Guaranteed to return a freshly allocated string. @end deffn -@deffn primitive string-concatenate-reverse/shared ls final_string end +@deffn {Scheme Procedure} string-concatenate-reverse/shared ls final_string end Like @code{string-concatenate-reverse}, but the result may share memory with the the strings in the @var{ls} arguments. @end deffn @@ -1619,29 +1619,29 @@ share memory with the the strings in the @var{ls} arguments. the characters a string is composed of. The fold and unfold procedures are list iterators and constructors. -@deffn primitive string-map proc s [start end] +@deffn {Scheme Procedure} string-map proc s [start end] @var{proc} is a char->char procedure, it is mapped over @var{s}. The order in which the procedure is applied to the string elements is not specified. @end deffn -@deffn primitive string-map! proc s [start end] +@deffn {Scheme Procedure} string-map! proc s [start end] @var{proc} is a char->char procedure, it is mapped over @var{s}. The order in which the procedure is applied to the string elements is not specified. The string @var{s} is modified in-place, the return value is not specified. @end deffn -@deffn primitive string-fold kons knil s [start end] -@deffnx primitive string-fold-right kons knil s [start end] +@deffn {Scheme Procedure} string-fold kons knil s [start end] +@deffnx {Scheme Procedure} string-fold-right kons knil s [start end] Fold @var{kons} over the characters of @var{s}, with @var{knil} as the terminating element, from left to right (or right to left, for @code{string-fold-right}). @var{kons} must expect two arguments: The actual character and the last result of @var{kons}' application. @end deffn -@deffn primitive string-unfold p f g seed [base make_final] -@deffnx primitive string-unfold-right p f g seed [base make_final] +@deffn {Scheme Procedure} string-unfold p f g seed [base make_final] +@deffnx {Scheme Procedure} string-unfold-right p f g seed [base make_final] These are the fundamental string constructors. @itemize @bullet @item @var{g} is used to generate a series of @emph{seed} @@ -1662,7 +1662,7 @@ value (on which @var{p} returns true) to produce the final/rightmost @end itemize @end deffn -@deffn primitive string-for-each proc s [start end] +@deffn {Scheme Procedure} string-for-each proc s [start end] @var{proc} is mapped over @var{s} in left-to-right order. The return value is not specified. @end deffn @@ -1684,7 +1684,7 @@ consider this code fragment, which replicates the input string "foofoo" @end lisp -@deffn primitive xsubstring s from [to start end] +@deffn {Scheme Procedure} xsubstring s from [to start end] This is the @emph{extended substring} procedure that implements replicated copying of a substring of some string. @@ -1697,7 +1697,7 @@ beginning at index @var{from}, and ending at @var{to}, which defaults to @var{from} + (@var{end} - @var{start}). @end deffn -@deffn primitive string-xcopy! target tstart s sfrom [sto start end] +@deffn {Scheme Procedure} string-xcopy! target tstart s sfrom [sto start end] Exactly the same as @code{xsubstring}, but the extracted text is written into the string @var{target} starting at index @var{tstart}. The operation is not defined if @code{(eq? @@ -1715,13 +1715,13 @@ cannot copy a string on top of itself. another string and @code{string-tokenize} splits a string into a list of strings, breaking it up at a specified character. -@deffn primitive string-replace s1 s2 [start1 end1 start2 end2] +@deffn {Scheme Procedure} string-replace s1 s2 [start1 end1 start2 end2] Return the string @var{s1}, but with the characters @var{start1} @dots{} @var{end1} replaced by the characters @var{start2} @dots{} @var{end2} from @var{s2}. @end deffn -@deffn primitive string-tokenize s [token_char start end] +@deffn {Scheme Procedure} string-tokenize s [token_char start end] Split the string @var{s} into a list of substrings, where each substring is a maximal non-empty contiguous sequence of characters equal to the character @var{token_char}, or @@ -1739,7 +1739,7 @@ token borders. @dfn{Filtering} means to remove all characters from a string which do not match a given criteria, @dfn{deleting} means the opposite. -@deffn primitive string-filter s char_pred [start end] +@deffn {Scheme Procedure} string-filter s char_pred [start end] Filter the string @var{s}, retaining only those characters that satisfy the @var{char_pred} argument. If the argument is a procedure, it is applied to each character as a predicate, if @@ -1747,7 +1747,7 @@ it is a character, it is tested for equality and if it is a character set, it is tested for membership. @end deffn -@deffn primitive string-delete s char_pred [start end] +@deffn {Scheme Procedure} string-delete s char_pred [start end] Filter the string @var{s}, retaining only those characters that do not satisfy the @var{char_pred} argument. If the argument is a procedure, it is applied to each character as a predicate, @@ -1823,21 +1823,21 @@ or whether several character sets are equal or subsets of each other. @code{char-set-hash} can be used for calculating a hash value, maybe for usage in fast lookup procedures. -@deffn primitive char-set? obj +@deffn {Scheme Procedure} char-set? obj Return @code{#t} if @var{obj} is a character set, @code{#f} otherwise. @end deffn -@deffn primitive char-set= cs1 @dots{} +@deffn {Scheme Procedure} char-set= cs1 @dots{} Return @code{#t} if all given character sets are equal. @end deffn -@deffn primitive char-set<= cs1 @dots{} +@deffn {Scheme Procedure} char-set<= cs1 @dots{} Return @code{#t} if every character set @var{cs}i is a subset of character set @var{cs}i+1. @end deffn -@deffn primitive char-set-hash cs [bound] +@deffn {Scheme Procedure} char-set-hash cs [bound] Compute a hash value for the character set @var{cs}. If @var{bound} is given and not @code{#f}, it restricts the returned value to the range 0 @dots{} @var{bound - 1}. @@ -1859,34 +1859,34 @@ element of the set can be checked with @code{end-of-char-set?}. Additionally, mapping and (un-)folding procedures for character sets are provided. -@deffn primitive char-set-cursor cs +@deffn {Scheme Procedure} char-set-cursor cs Return a cursor into the character set @var{cs}. @end deffn -@deffn primitive char-set-ref cs cursor +@deffn {Scheme Procedure} char-set-ref cs cursor Return the character at the current cursor position @var{cursor} in the character set @var{cs}. It is an error to pass a cursor for which @code{end-of-char-set?} returns true. @end deffn -@deffn primitive char-set-cursor-next cs cursor +@deffn {Scheme Procedure} char-set-cursor-next cs cursor Advance the character set cursor @var{cursor} to the next character in the character set @var{cs}. It is an error if the cursor given satisfies @code{end-of-char-set?}. @end deffn -@deffn primitive end-of-char-set? cursor +@deffn {Scheme Procedure} end-of-char-set? cursor Return @code{#t} if @var{cursor} has reached the end of a character set, @code{#f} otherwise. @end deffn -@deffn primitive char-set-fold kons knil cs +@deffn {Scheme Procedure} char-set-fold kons knil cs Fold the procedure @var{kons} over the character set @var{cs}, initializing it with @var{knil}. @end deffn -@deffn primitive char-set-unfold p f g seed [base_cs] -@deffnx primitive char-set-unfold! p f g seed base_cs +@deffn {Scheme Procedure} char-set-unfold p f g seed [base_cs] +@deffnx {Scheme Procedure} char-set-unfold! p f g seed base_cs This is a fundamental constructor for character sets. @itemize @bullet @item @var{g} is used to generate a series of ``seed'' values @@ -1902,12 +1902,12 @@ form the result; @var{base_cs} defaults to the empty set. @code{char-set-unfold!} is the side-effecting variant. @end deffn -@deffn primitive char-set-for-each proc cs +@deffn {Scheme Procedure} char-set-for-each proc cs Apply @var{proc} to every character in the character set @var{cs}. The return value is not specified. @end deffn -@deffn primitive char-set-map proc cs +@deffn {Scheme Procedure} char-set-map proc cs Map the procedure @var{proc} over every character in @var{cs}. @var{proc} must be a character -> character procedure. @end deffn @@ -1920,17 +1920,17 @@ Map the procedure @var{proc} over every character in @var{cs}. New character sets are produced with these procedures. -@deffn primitive char-set-copy cs +@deffn {Scheme Procedure} char-set-copy cs Return a newly allocated character set containing all characters in @var{cs}. @end deffn -@deffn primitive char-set char1 @dots{} +@deffn {Scheme Procedure} char-set char1 @dots{} Return a character set containing all given characters. @end deffn -@deffn primitive list->char-set char_list [base_cs] -@deffnx primitive list->char-set! char_list base_cs +@deffn {Scheme Procedure} list->char-set char_list [base_cs] +@deffnx {Scheme Procedure} list->char-set! char_list base_cs Convert the character list @var{list} to a character set. If the character set @var{base_cs} is given, the character in this set are also included in the result. @@ -1938,8 +1938,8 @@ set are also included in the result. @code{list->char-set!} is the side-effecting variant. @end deffn -@deffn primitive string->char-set s [base_cs] -@deffnx primitive string->char-set! s base_cs +@deffn {Scheme Procedure} string->char-set s [base_cs] +@deffnx {Scheme Procedure} string->char-set! s base_cs Convert the string @var{str} to a character set. If the character set @var{base_cs} is given, the characters in this set are also included in the result. @@ -1947,8 +1947,8 @@ set are also included in the result. @code{string->char-set!} is the side-effecting variant. @end deffn -@deffn primitive char-set-filter pred cs [base_cs] -@deffnx primitive char-set-filter! pred cs base_cs +@deffn {Scheme Procedure} char-set-filter pred cs [base_cs] +@deffnx {Scheme Procedure} char-set-filter! pred cs base_cs Return a character set containing every character from @var{cs} so that it satisfies @var{pred}. If provided, the characters from @var{base_cs} are added to the result. @@ -1956,8 +1956,8 @@ from @var{base_cs} are added to the result. @code{char-set-filter!} is the side-effecting variant. @end deffn -@deffn primitive ucs-range->char-set lower upper [error? base_cs] -@deffnx primitive uce-range->char-set! lower upper error? base_cs +@deffn {Scheme Procedure} ucs-range->char-set lower upper [error? base_cs] +@deffnx {Scheme Procedure} uce-range->char-set! lower upper error? base_cs Return a character set containing all characters whose character codes lie in the half-open range [@var{lower},@var{upper}). @@ -1974,7 +1974,7 @@ given. @code{ucs-range->char-set!} is the side-effecting variant. @end deffn -@deffn procedure ->char-set x +@deffn {Scheme Procedure} ->char-set x Coerce @var{x} into a character set. @var{x} may be a string, a character or a character set. @end deffn @@ -1988,37 +1988,37 @@ character or a character set. Access the elements and other information of a character set with these procedures. -@deffn primitive char-set-size cs +@deffn {Scheme Procedure} char-set-size cs Return the number of elements in character set @var{cs}. @end deffn -@deffn primitive char-set-count pred cs +@deffn {Scheme Procedure} char-set-count pred cs Return the number of the elements int the character set @var{cs} which satisfy the predicate @var{pred}. @end deffn -@deffn primitive char-set->list cs +@deffn {Scheme Procedure} char-set->list cs Return a list containing the elements of the character set @var{cs}. @end deffn -@deffn primitive char-set->string cs +@deffn {Scheme Procedure} char-set->string cs Return a string containing the elements of the character set @var{cs}. The order in which the characters are placed in the string is not defined. @end deffn -@deffn primitive char-set-contains? cs char +@deffn {Scheme Procedure} char-set-contains? cs char Return @code{#t} iff the character @var{ch} is contained in the character set @var{cs}. @end deffn -@deffn primitive char-set-every pred cs +@deffn {Scheme Procedure} char-set-every pred cs Return a true value if every character in the character set @var{cs} satisfies the predicate @var{pred}. @end deffn -@deffn primitive char-set-any pred cs +@deffn {Scheme Procedure} char-set-any pred cs Return a true value if any character in the character set @var{cs} satisfies the predicate @var{pred}. @end deffn @@ -2034,45 +2034,45 @@ such as union, complement, intersection etc. All of these procedures provide side-effecting variants, which modify their character set argument(s). -@deffn primitive char-set-adjoin cs char1 @dots{} -@deffnx primitive char-set-adjoin! cs char1 @dots{} +@deffn {Scheme Procedure} char-set-adjoin cs char1 @dots{} +@deffnx {Scheme Procedure} char-set-adjoin! cs char1 @dots{} Add all character arguments to the first argument, which must be a character set. @end deffn -@deffn primitive char-set-delete cs char1 @dots{} -@deffnx primitive char-set-delete! cs char1 @dots{} +@deffn {Scheme Procedure} char-set-delete cs char1 @dots{} +@deffnx {Scheme Procedure} char-set-delete! cs char1 @dots{} Delete all character arguments from the first argument, which must be a character set. @end deffn -@deffn primitive char-set-complement cs -@deffnx primitive char-set-complement! cs +@deffn {Scheme Procedure} char-set-complement cs +@deffnx {Scheme Procedure} char-set-complement! cs Return the complement of the character set @var{cs}. @end deffn -@deffn primitive char-set-union cs1 @dots{} -@deffnx primitive char-set-union! cs1 @dots{} +@deffn {Scheme Procedure} char-set-union cs1 @dots{} +@deffnx {Scheme Procedure} char-set-union! cs1 @dots{} Return the union of all argument character sets. @end deffn -@deffn primitive char-set-intersection cs1 @dots{} -@deffnx primitive char-set-intersection! cs1 @dots{} +@deffn {Scheme Procedure} char-set-intersection cs1 @dots{} +@deffnx {Scheme Procedure} char-set-intersection! cs1 @dots{} Return the intersection of all argument character sets. @end deffn -@deffn primitive char-set-difference cs1 @dots{} -@deffnx primitive char-set-difference! cs1 @dots{} +@deffn {Scheme Procedure} char-set-difference cs1 @dots{} +@deffnx {Scheme Procedure} char-set-difference! cs1 @dots{} Return the difference of all argument character sets. @end deffn -@deffn primitive char-set-xor cs1 @dots{} -@deffnx primitive char-set-xor! cs1 @dots{} +@deffn {Scheme Procedure} char-set-xor cs1 @dots{} +@deffnx {Scheme Procedure} char-set-xor! cs1 @dots{} Return the exclusive-or of all argument character sets. @end deffn -@deffn primitive char-set-diff+intersection cs1 @dots{} -@deffnx primitive char-set-diff+intersection! cs1 @dots{} +@deffn {Scheme Procedure} char-set-diff+intersection cs1 @dots{} +@deffnx {Scheme Procedure} char-set-diff+intersection! cs1 @dots{} Return the difference and the intersection of all argument character sets. @end deffn diff --git a/libguile/ChangeLog b/libguile/ChangeLog index d89307087..002cd3521 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,5 +1,30 @@ 2001-11-16 Neil Jerram <neil@ossau.uklinux.net> + * gc.h (scm_unhash_name): Old declaration removed. + + * eval.c (s_scm_eval): Change @var{primitive-eval} to + @code{primitive-eval}. + + * feature.c, vectors.c, net_db.c, unif.c, weaks.c, struct.c, + version.c, alist.c, ports.c, ramap.c, unif.c, strings.c, list.c: + Change @deffnx lines in docstrings to say {Scheme Procedure} + rather than primitive or procedure. + + * posix.c (scm_execl), filesys.c (scm_close), unif.c + (scm_array_set_x, scm_array_contents, scm_uniform_array_read_x, + scm_bit_set_star_x, scm_bit_invert_x), ramap.c (scm_array_fill_x, + scm_array_for_each, scm_array_index_map_x), vectors.c (scm_vector, + scm_make_vector, scm_vector_to_list, scm_vector_fill_x), strop.c + (scm_string_split, scm_string_ci_to_symbol), strings.c + (scm_string_p), sort.c (scm_merge), print.c (scm_newline), + macros.c (scm_macro_type), alist.c (scm_acons, scm_assq): + Docstring fixes and improvements reflecting edits that have been + made in the reference manual source. + + * objprop.c (scm_object_properties, scm_set_object_properties_x, + scm_object_property, scm_set_object_property_x): Remove invalid + @deffnx lines for corresponding procedure property primitives. + These changes add a @deffnx C function declaration and function index entries for each Guile primitive to the copy of the doc snarf output that is used for reference manual synchronization. diff --git a/libguile/alist.c b/libguile/alist.c index e2fa86068..9bb44cca8 100644 --- a/libguile/alist.c +++ b/libguile/alist.c @@ -52,7 +52,7 @@ SCM_DEFINE (scm_acons, "acons", 3, 0, 0, (SCM key, SCM value, SCM alist), - "Adds a new key-value pair to @var{alist}. A new pair is\n" + "Add a new key-value pair to @var{alist}. A new pair is\n" "created whose car is @var{key} and whose cdr is @var{value}, and the\n" "pair is consed onto @var{alist}, and the new list is returned. This\n" "function is @emph{not} destructive; @var{alist} is not modified.") @@ -133,14 +133,14 @@ SCM_DEFINE (scm_sloppy_assoc, "sloppy-assoc", 2, 0, 0, SCM_DEFINE (scm_assq, "assq", 2, 0, 0, (SCM key, SCM alist), - "@deffnx primitive assv key alist\n" - "@deffnx primitive assoc key alist\n" - "Fetches the entry in @var{alist} that is associated with @var{key}. To\n" + "@deffnx {Scheme Procedure} assv key alist\n" + "@deffnx {Scheme Procedure} assoc key alist\n" + "Fetch the entry in @var{alist} that is associated with @var{key}. To\n" "decide whether the argument @var{key} matches a particular entry in\n" "@var{alist}, @code{assq} compares keys with @code{eq?}, @code{assv}\n" "uses @code{eqv?} and @code{assoc} uses @code{equal?}. If @var{key}\n" "cannot be found in @var{alist} (according to whichever equality\n" - "predicate is in use), then @code{#f} is returned. These functions\n" + "predicate is in use), then return @code{#f}. These functions\n" "return the entire alist entry found (i.e. both the key and the value).") #define FUNC_NAME s_scm_assq { @@ -218,8 +218,8 @@ SCM_DEFINE (scm_assoc, "assoc", 2, 0, 0, */ SCM_DEFINE (scm_assq_ref, "assq-ref", 2, 0, 0, (SCM alist, SCM key), - "@deffnx primitive assv-ref alist key\n" - "@deffnx primitive assoc-ref alist key\n" + "@deffnx {Scheme Procedure} assv-ref alist key\n" + "@deffnx {Scheme Procedure} assoc-ref alist key\n" "Like @code{assq}, @code{assv} and @code{assoc}, except that only the\n" "value associated with @var{key} in @var{alist} is returned. These\n" "functions are equivalent to\n\n" @@ -282,8 +282,8 @@ SCM_DEFINE (scm_assoc_ref, "assoc-ref", 2, 0, 0, SCM_DEFINE (scm_assq_set_x, "assq-set!", 3, 0, 0, (SCM alist, SCM key, SCM val), - "@deffnx primitive assv-set! alist key value\n" - "@deffnx primitive assoc-set! alist key value\n" + "@deffnx {Scheme Procedure} assv-set! alist key value\n" + "@deffnx {Scheme Procedure} assoc-set! alist key value\n" "Reassociate @var{key} in @var{alist} with @var{value}: find any existing\n" "@var{alist} entry for @var{key} and associate it with the new\n" "@var{value}. If @var{alist} does not contain an entry for @var{key},\n" @@ -347,8 +347,8 @@ SCM_DEFINE (scm_assoc_set_x, "assoc-set!", 3, 0, 0, SCM_DEFINE (scm_assq_remove_x, "assq-remove!", 2, 0, 0, (SCM alist, SCM key), - "@deffnx primitive assv-remove! alist key\n" - "@deffnx primitive assoc-remove! alist key\n" + "@deffnx {Scheme Procedure} assv-remove! alist key\n" + "@deffnx {Scheme Procedure} assoc-remove! alist key\n" "Delete the first entry in @var{alist} associated with @var{key}, and return\n" "the resulting alist.") #define FUNC_NAME s_scm_assq_remove_x diff --git a/libguile/eval.c b/libguile/eval.c index 6a05083fa..2977da696 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -4069,7 +4069,7 @@ SCM_DEFINE (scm_eval, "eval", 2, 0, 0, (SCM exp, SCM module), "Evaluate @var{exp}, a list representing a Scheme expression,\n" "in the top-level environment specified by @var{module}.\n" - "While @var{exp} is evaluated (using @var{primitive-eval}),\n" + "While @var{exp} is evaluated (using @code{primitive-eval}),\n" "@var{module} is made the current module. The current module\n" "is reset to its previous value when @var{eval} returns.") #define FUNC_NAME s_scm_eval diff --git a/libguile/feature.c b/libguile/feature.c index 30f5325c3..5748fd30b 100644 --- a/libguile/feature.c +++ b/libguile/feature.c @@ -70,7 +70,7 @@ scm_add_feature (const char *str) SCM_DEFINE (scm_program_arguments, "program-arguments", 0, 0, 0, (), - "@deffnx procedure command-line\n" + "@deffnx {Scheme Procedure} command-line\n" "Return the list of command line arguments passed to Guile, as a list of\n" "strings. The list includes the invoked program name, which is usually\n" "@code{\"guile\"}, but excludes switches and parameters for command line\n" diff --git a/libguile/filesys.c b/libguile/filesys.c index f891be40e..b8a9aadc9 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -382,7 +382,7 @@ SCM_DEFINE (scm_open, "open", 2, 1, 0, SCM_DEFINE (scm_close, "close", 1, 0, 0, (SCM fd_or_port), - "Similar to close-port (@pxref{Generic Port Operations, close-port}),\n" + "Similar to close-port (@pxref{Closing, close-port}),\n" "but also works on file descriptors. A side\n" "effect of closing a file descriptor is that any ports using that file\n" "descriptor are moved to a different file descriptor and have\n" diff --git a/libguile/gc.h b/libguile/gc.h index c392b5d07..5e2a01ec4 100644 --- a/libguile/gc.h +++ b/libguile/gc.h @@ -351,7 +351,6 @@ SCM_API void scm_assert_cell_valid (SCM); SCM_API SCM scm_set_debug_cell_accesses_x (SCM flag); #endif SCM_API SCM scm_object_address (SCM obj); -SCM_API SCM scm_unhash_name (SCM name); SCM_API SCM scm_gc_stats (void); SCM_API SCM scm_gc (void); SCM_API void scm_gc_for_alloc (struct scm_t_freelist *freelist); diff --git a/libguile/list.c b/libguile/list.c index a2f29f034..b709b882d 100644 --- a/libguile/list.c +++ b/libguile/list.c @@ -445,7 +445,7 @@ SCM_REGISTER_PROC(s_list_cdr_ref, "list-cdr-ref", 2, 0, 0, scm_list_tail); SCM_DEFINE (scm_list_tail, "list-tail", 2, 0, 0, (SCM lst, SCM k), - "@deffnx primitive list-cdr-ref lst k\n" + "@deffnx {Scheme Procedure} list-cdr-ref lst k\n" "Return the \"tail\" of @var{lst} beginning with its @var{k}th element.\n" "The first element of the list is considered to be element 0.\n\n" "@code{list-tail} and @code{list-cdr-ref} are identical. It may help to\n" @@ -628,8 +628,8 @@ SCM_DEFINE (scm_member, "member", 2, 0, 0, SCM_DEFINE (scm_delq_x, "delq!", 2, 0, 0, (SCM item, SCM lst), - "@deffnx primitive delv! item lst\n" - "@deffnx primitive delete! item lst\n" + "@deffnx {Scheme Procedure} delv! item lst\n" + "@deffnx {Scheme Procedure} delete! item lst\n" "These procedures are destructive versions of @code{delq}, @code{delv}\n" "and @code{delete}: they modify the pointers in the existing @var{lst}\n" "rather than creating a new list. Caveat evaluator: Like other\n" diff --git a/libguile/macros.c b/libguile/macros.c index 8f011c055..aac969fdb 100644 --- a/libguile/macros.c +++ b/libguile/macros.c @@ -175,7 +175,7 @@ SCM_DEFINE (scm_macro_type, "macro-type", 1, 0, 0, (SCM m), "Return one of the symbols @code{syntax}, @code{macro} or\n" "@code{macro!}, depending on whether @var{m} is a syntax\n" - "tranformer, a regular macro, or a memoizing macro,\n" + "transformer, a regular macro, or a memoizing macro,\n" "respectively. If @var{m} is not a macro, @code{#f} is\n" "returned.") #define FUNC_NAME s_scm_macro_type diff --git a/libguile/net_db.c b/libguile/net_db.c index 8afd9244c..d32819ee8 100644 --- a/libguile/net_db.c +++ b/libguile/net_db.c @@ -136,8 +136,8 @@ static void scm_resolv_error (const char *subr, SCM bad_value) SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0, (SCM host), - "@deffnx procedure gethostbyname hostname\n" - "@deffnx procedure gethostbyaddr address\n" + "@deffnx {Scheme Procedure} gethostbyname hostname\n" + "@deffnx {Scheme Procedure} gethostbyaddr address\n" "Look up a host by name or address, returning a host object. The\n" "@code{gethost} procedure will accept either a string name or an integer\n" "address; if given no arguments, it behaves like @code{gethostent} (see\n" @@ -219,8 +219,8 @@ SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0, #if defined(HAVE_GETNETENT) && defined(HAVE_GETNETBYNAME) && defined(HAVE_GETNETBYADDR) SCM_DEFINE (scm_getnet, "getnet", 0, 1, 0, (SCM net), - "@deffnx procedure getnetbyname net-name\n" - "@deffnx procedure getnetbyaddr net-number\n" + "@deffnx {Scheme Procedure} getnetbyname net-name\n" + "@deffnx {Scheme Procedure} getnetbyaddr net-number\n" "Look up a network by name or net number in the network database. The\n" "@var{net-name} argument must be a string, and the @var{net-number}\n" "argument must be an integer. @code{getnet} will accept either type of\n" @@ -269,8 +269,8 @@ SCM_DEFINE (scm_getnet, "getnet", 0, 1, 0, #ifdef HAVE_GETPROTOENT SCM_DEFINE (scm_getproto, "getproto", 0, 1, 0, (SCM protocol), - "@deffnx procedure getprotobyname name\n" - "@deffnx procedure getprotobynumber number\n" + "@deffnx {Scheme Procedure} getprotobyname name\n" + "@deffnx {Scheme Procedure} getprotobynumber number\n" "Look up a network protocol by name or by number. @code{getprotobyname}\n" "takes a string argument, and @code{getprotobynumber} takes an integer\n" "argument. @code{getproto} will accept either type, behaving like\n" @@ -332,8 +332,8 @@ scm_return_entry (struct servent *entry) SCM_DEFINE (scm_getserv, "getserv", 0, 2, 0, (SCM name, SCM protocol), - "@deffnx procedure getservbyname name protocol\n" - "@deffnx procedure getservbyport port protocol\n" + "@deffnx {Scheme Procedure} getservbyname name protocol\n" + "@deffnx {Scheme Procedure} getservbyport port protocol\n" "Look up a network service by name or by service number, and return a\n" "network service object. The @var{protocol} argument specifies the name\n" "of the desired protocol; if the protocol found in the network service\n" diff --git a/libguile/objprop.c b/libguile/objprop.c index 4d5dd79cb..aa3883165 100644 --- a/libguile/objprop.c +++ b/libguile/objprop.c @@ -56,7 +56,6 @@ SCM_DEFINE (scm_object_properties, "object-properties", 1, 0, 0, (SCM obj), - "@deffnx primitive procedure-properties obj\n" "Return @var{obj}'s property list.") #define FUNC_NAME s_scm_object_properties { @@ -67,7 +66,6 @@ SCM_DEFINE (scm_object_properties, "object-properties", 1, 0, 0, SCM_DEFINE (scm_set_object_properties_x, "set-object-properties!", 2, 0, 0, (SCM obj, SCM alist), - "@deffnx primitive set-procedure-properties! obj alist\n" "Set @var{obj}'s property list to @var{alist}.") #define FUNC_NAME s_scm_set_object_properties_x { @@ -79,7 +77,6 @@ SCM_DEFINE (scm_set_object_properties_x, "set-object-properties!", 2, 0, 0, SCM_DEFINE (scm_object_property, "object-property", 2, 0, 0, (SCM obj, SCM key), - "@deffnx primitive procedure-property obj key\n" "Return the property of @var{obj} with name @var{key}.") #define FUNC_NAME s_scm_object_property { @@ -91,7 +88,6 @@ SCM_DEFINE (scm_object_property, "object-property", 2, 0, 0, SCM_DEFINE (scm_set_object_property_x, "set-object-property!", 3, 0, 0, (SCM obj, SCM key, SCM value), - "@deffnx primitive set-procedure-property! obj key value\n" "In @var{obj}'s property list, set the property named @var{key}\n" "to @var{value}.") #define FUNC_NAME s_scm_set_object_property_x diff --git a/libguile/ports.c b/libguile/ports.c index 0250f503c..6e79e9ab7 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -395,8 +395,8 @@ SCM_DEFINE (scm_current_load_port, "current-load-port", 0, 0, 0, SCM_DEFINE (scm_set_current_input_port, "set-current-input-port", 1, 0, 0, (SCM port), - "@deffnx primitive set-current-output-port port\n" - "@deffnx primitive set-current-error-port port\n" + "@deffnx {Scheme Procedure} set-current-output-port port\n" + "@deffnx {Scheme Procedure} set-current-error-port port\n" "Change the ports returned by @code{current-input-port},\n" "@code{current-output-port} and @code{current-error-port}, respectively,\n" "so that they use the supplied @var{port} for input or output.") @@ -1400,7 +1400,7 @@ SCM_DEFINE (scm_set_port_line_x, "set-port-line!", 2, 0, 0, SCM_DEFINE (scm_port_column, "port-column", 1, 0, 0, (SCM port), - "@deffnx primitive port-line port\n" + "@deffnx {Scheme Procedure} port-line port\n" "Return the current column number or line number of @var{port},\n" "using the current input port if none is specified. If the number is\n" "unknown, the result is #f. Otherwise, the result is a 0-origin integer\n" @@ -1419,7 +1419,7 @@ SCM_DEFINE (scm_port_column, "port-column", 1, 0, 0, SCM_DEFINE (scm_set_port_column_x, "set-port-column!", 2, 0, 0, (SCM port, SCM column), - "@deffnx primitive set-port-line! port line\n" + "@deffnx {Scheme Procedure} set-port-line! port line\n" "Set the current column or line number of @var{port}, using the\n" "current input port if none is specified.") #define FUNC_NAME s_scm_set_port_column_x diff --git a/libguile/posix.c b/libguile/posix.c index acec88b08..6e2393570 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -867,7 +867,7 @@ SCM_DEFINE (scm_execl, "execl", 1, 0, 1, "The remaining arguments are supplied to the process; from a C program\n" "they are accessable as the @code{argv} argument to @code{main}.\n" "Conventionally the first @var{arg} is the same as @var{path}.\n" - "All arguments must be strings. \n\n" + "All arguments must be strings.\n\n" "If @var{arg} is missing, @var{path} is executed with a null\n" "argument list, which may have system-dependent side-effects.\n\n" "This procedure is currently implemented using the @code{execv} system\n" diff --git a/libguile/print.c b/libguile/print.c index 369b112bb..3e7849314 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -992,7 +992,8 @@ SCM_DEFINE (scm_simple_format, "simple-format", 2, 0, 1, SCM_DEFINE (scm_newline, "newline", 0, 1, 0, (SCM port), - "Send a newline to @var{port}.") + "Send a newline to @var{port}.\n" + "If @var{port} is omitted, send to the current output port.") #define FUNC_NAME s_scm_newline { if (SCM_UNBNDP (port)) diff --git a/libguile/ramap.c b/libguile/ramap.c index 4e0e712c8..9cc642f0b 100644 --- a/libguile/ramap.c +++ b/libguile/ramap.c @@ -458,7 +458,7 @@ scm_ramapc (int (*cproc)(), SCM data, SCM ra0, SCM lra, const char *what) SCM_DEFINE (scm_array_fill_x, "array-fill!", 2, 0, 0, (SCM ra, SCM fill), - "Stores @var{fill} in every element of @var{array}. The value returned\n" + "Store @var{fill} in every element of @var{array}. The value returned\n" "is unspecified.") #define FUNC_NAME s_scm_array_fill_x { @@ -829,8 +829,8 @@ SCM_REGISTER_PROC(s_array_copy_in_order_x, "array-copy-in-order!", 2, 0, 0, scm_ SCM_DEFINE (scm_array_copy_x, "array-copy!", 2, 0, 0, (SCM src, SCM dst), - "@deffnx primitive array-copy-in-order! src dst\n" - "Copies every element from vector or array @var{source} to the\n" + "@deffnx {Scheme Procedure} array-copy-in-order! src dst\n" + "Copy every element from vector or array @var{source} to the\n" "corresponding element of @var{destination}. @var{destination} must have\n" "the same rank as @var{source}, and be at least as large in each\n" "dimension. The order is unspecified.") @@ -1512,7 +1512,7 @@ SCM_REGISTER_PROC(s_array_map_in_order_x, "array-map-in-order!", 2, 0, 1, scm_ar SCM_DEFINE (scm_array_map_x, "array-map!", 2, 0, 1, (SCM ra0, SCM proc, SCM lra), - "@deffnx primitive array-map-in-order! ra0 proc . lra\n" + "@deffnx {Scheme Procedure} array-map-in-order! ra0 proc . lra\n" "@var{array1}, @dots{} must have the same number of dimensions as\n" "@var{array0} and have a range for each index which includes the range\n" "for the corresponding index in @var{array0}. @var{proc} is applied to\n" @@ -1664,7 +1664,7 @@ rafe (SCM ra0,SCM proc,SCM ras) SCM_DEFINE (scm_array_for_each, "array-for-each", 2, 0, 1, (SCM proc, SCM ra0, SCM lra), - "@var{proc} is applied to each tuple of elements of @var{array0} @dots{}\n" + "Apply @var{proc} to each tuple of elements of @var{array0} @dots{}\n" "in row-major order. The value returned is unspecified.") #define FUNC_NAME s_scm_array_for_each { @@ -1677,7 +1677,7 @@ SCM_DEFINE (scm_array_for_each, "array-for-each", 2, 0, 1, SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0, (SCM ra, SCM proc), - "applies @var{proc} to the indices of each element of @var{array} in\n" + "Apply @var{proc} to the indices of each element of @var{array} in\n" "turn, storing the result in the corresponding element. The value\n" "returned and the order of application are unspecified.\n\n" "One can implement @var{array-indexes} as\n" diff --git a/libguile/sort.c b/libguile/sort.c index 70de17505..7519ed2f2 100644 --- a/libguile/sort.c +++ b/libguile/sort.c @@ -516,9 +516,10 @@ SCM_DEFINE (scm_sorted_p, "sorted?", 2, 0, 0, Note: this does _not_ accept vectors. */ SCM_DEFINE (scm_merge, "merge", 3, 0, 0, (SCM alist, SCM blist, SCM less), - "Takes two lists @var{alist} and @var{blist} such that\n" - "@code{(sorted? alist less?)} and @code{(sorted? blist less?)} and\n" - "returns a new list in which the elements of @var{alist} and\n" + "Merge two already sorted lists into one.\n" + "Given two lists @var{alist} and @var{blist}, such that\n" + "@code{(sorted? alist less?)} and @code{(sorted? blist less?)},\n" + "return a new list in which the elements of @var{alist} and\n" "@var{blist} have been stably interleaved so that\n" "@code{(sorted? (merge alist blist less?) less?)}.\n" "Note: this does _not_ accept vectors.") diff --git a/libguile/strings.c b/libguile/strings.c index eef9f4a7f..8bd7de872 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -58,8 +58,7 @@ SCM_DEFINE (scm_string_p, "string?", 1, 0, 0, (SCM obj), - "Return @code{#t} iff @var{obj} is a string, else returns\n" - "@code{#f}.") + "Return @code{#t} iff @var{obj} is a string, else @code{#f}.") #define FUNC_NAME s_scm_string_p { return SCM_BOOL (SCM_STRINGP (obj)); @@ -71,7 +70,7 @@ SCM_REGISTER_PROC (s_scm_list_to_string, "list->string", 1, 0, 0, scm_string); SCM_DEFINE (scm_string, "string", 0, 0, 1, (SCM chrs), - "@deffnx primitive list->string chrs\n" + "@deffnx {Scheme Procedure} list->string chrs\n" "Return a newly allocated string composed of the arguments,\n" "@var{chrs}.") #define FUNC_NAME s_scm_string diff --git a/libguile/strop.c b/libguile/strop.c index 1271dea08..89cd02f62 100644 --- a/libguile/strop.c +++ b/libguile/strop.c @@ -472,15 +472,15 @@ SCM_DEFINE (scm_string_split, "string-split", 2, 0, 0, "result list.\n" "\n" "@lisp\n" - "(string-split \"root:x:0:0:root:/root:/bin/bash\" #\:)\n" + "(string-split \"root:x:0:0:root:/root:/bin/bash\" #\\:)\n" "@result{}\n" "(\"root\" \"x\" \"0\" \"0\" \"root\" \"/root\" \"/bin/bash\")\n" "\n" - "(string-split \"::\" #\:)\n" + "(string-split \"::\" #\\:)\n" "@result{}\n" "(\"\" \"\" \"\")\n" "\n" - "(string-split \"\" #\:)\n" + "(string-split \"\" #\\:)\n" "@result{}\n" "(\"\")\n" "@end lisp") @@ -518,7 +518,7 @@ SCM_DEFINE (scm_string_ci_to_symbol, "string-ci->symbol", 1, 0, 0, (SCM str), "Return the symbol whose name is @var{str}. @var{str} is\n" "converted to lowercase before the conversion is done, if Guile\n" - "is currently reading symbols case--insensitively.") + "is currently reading symbols case-insensitively.") #define FUNC_NAME s_scm_string_ci_to_symbol { return scm_string_to_symbol (SCM_CASE_INSENSITIVE_P diff --git a/libguile/struct.c b/libguile/struct.c index f24fefdb2..9a580cb41 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -560,7 +560,7 @@ SCM_DEFINE (scm_make_vtable_vtable, "make-vtable-vtable", 2, 0, 1, SCM_DEFINE (scm_struct_ref, "struct-ref", 2, 0, 0, (SCM handle, SCM pos), - "@deffnx primitive struct-set! struct n value\n" + "@deffnx {Scheme Procedure} struct-set! struct n value\n" "Access (or modify) the @var{n}th field of @var{struct}.\n\n" "If the field is of type 'p', then it can be set to an arbitrary value.\n\n" "If the field is of type 'u', then it can only be set to a non-negative\n" diff --git a/libguile/unif.c b/libguile/unif.c index 138fe36a8..17470207e 100644 --- a/libguile/unif.c +++ b/libguile/unif.c @@ -582,7 +582,7 @@ scm_shap2ra (SCM args, const char *what) SCM_DEFINE (scm_dimensions_to_uniform_array, "dimensions->uniform-array", 2, 1, 0, (SCM dims, SCM prot, SCM fill), - "@deffnx primitive make-uniform-vector length prototype [fill]\n" + "@deffnx {Scheme Procedure} make-uniform-vector length prototype [fill]\n" "Create and return a uniform array or vector of type\n" "corresponding to @var{prototype} with dimensions @var{dims} or\n" "length @var{length}. If @var{fill} is supplied, it's used to\n" @@ -1084,7 +1084,7 @@ SCM_REGISTER_PROC(s_array_ref, "array-ref", 1, 0, 1, scm_uniform_vector_ref); SCM_DEFINE (scm_uniform_vector_ref, "uniform-vector-ref", 2, 0, 0, (SCM v, SCM args), - "@deffnx primitive array-ref v . args\n" + "@deffnx {Scheme Procedure} array-ref v . args\n" "Return the element at the @code{(index1, index2)} element in\n" "@var{array}.") #define FUNC_NAME s_scm_uniform_vector_ref @@ -1262,8 +1262,8 @@ SCM_REGISTER_PROC(s_uniform_array_set1_x, "uniform-array-set1!", 3, 0, 0, scm_ar PROC is used (and it's called from C too). */ SCM_DEFINE (scm_array_set_x, "array-set!", 2, 0, 1, (SCM v, SCM obj, SCM args), - "@deffnx primitive uniform-array-set1! v obj args\n" - "Sets the element at the @code{(index1, index2)} element in @var{array} to\n" + "@deffnx {Scheme Procedure} uniform-array-set1! v obj args\n" + "Set the element at the @code{(index1, index2)} element in @var{array} to\n" "@var{new-value}. The value returned by array-set! is unspecified.") #define FUNC_NAME s_scm_array_set_x { @@ -1371,7 +1371,6 @@ SCM_DEFINE (scm_array_set_x, "array-set!", 2, 0, 1, wouldn't have contiguous elements. */ SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0, (SCM ra, SCM strict), - "@deffnx primitive array-contents array strict\n" "If @var{array} may be @dfn{unrolled} into a one dimensional shared array\n" "without changing their order (last subscript changing fastest), then\n" "@code{array-contents} returns that shared array, otherwise it returns\n" @@ -1482,11 +1481,11 @@ scm_ra2contig (SCM ra, int copy) SCM_DEFINE (scm_uniform_array_read_x, "uniform-array-read!", 1, 3, 0, (SCM ra, SCM port_or_fd, SCM start, SCM end), - "@deffnx primitive uniform-vector-read! uve [port-or-fdes] [start] [end]\n" - "Attempts to read all elements of @var{ura}, in lexicographic order, as\n" + "@deffnx {Scheme Procedure} uniform-vector-read! uve [port-or-fdes] [start] [end]\n" + "Attempt to read all elements of @var{ura}, in lexicographic order, as\n" "binary objects from @var{port-or-fdes}.\n" - "If an end of file is encountered during\n" - "uniform-array-read! the objects up to that point only are put into @var{ura}\n" + "If an end of file is encountered,\n" + "the objects up to that point are put into @var{ura}\n" "(starting at the beginning) and the remainder of the array is\n" "unchanged.\n\n" "The optional arguments @var{start} and @var{end} allow\n" @@ -1650,7 +1649,7 @@ loop: SCM_DEFINE (scm_uniform_array_write, "uniform-array-write", 1, 3, 0, (SCM v, SCM port_or_fd, SCM start, SCM end), - "@deffnx primitive uniform-vector-write uve [port-or-fdes] [start] [end]\n" + "@deffnx {Scheme Procedure} uniform-vector-write uve [port-or-fdes] [start] [end]\n" "Writes all elements of @var{ura} as binary objects to\n" "@var{port-or-fdes}.\n\n" "The optional arguments @var{start}\n" @@ -1890,7 +1889,7 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0, "length. If @var{bool} is @code{#t}, uve is OR'ed into\n" "@var{bv}; If @var{bool} is @code{#f}, the inversion of uve is\n" "AND'ed into @var{bv}.\n\n" - "If uve is a unsigned integer vector all the elements of uve\n" + "If uve is a unsigned long integer vector all the elements of uve\n" "must be between 0 and the @code{length} of @var{bv}. The bits\n" "of @var{bv} corresponding to the indexes in uve are set to\n" "@var{bool}. The return value is unspecified.") @@ -2011,7 +2010,7 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0, SCM_DEFINE (scm_bit_invert_x, "bit-invert!", 1, 0, 0, (SCM v), - "Modifies @var{bv} by replacing each element with its negation.") + "Modify @var{bv} by replacing each element with its negation.") #define FUNC_NAME s_scm_bit_invert_x { long int k; @@ -2187,7 +2186,7 @@ static int l2ra(SCM lst, SCM ra, unsigned long base, unsigned long k); SCM_DEFINE (scm_list_to_uniform_array, "list->uniform-array", 3, 0, 0, (SCM ndim, SCM prot, SCM lst), - "@deffnx procedure list->uniform-vector prot lst\n" + "@deffnx {Scheme Procedure} list->uniform-vector prot lst\n" "Return a uniform array of the type indicated by prototype\n" "@var{prot} with elements the same as those of @var{lst}.\n" "Elements must be of the appropriate type, no coercions are\n" diff --git a/libguile/vectors.c b/libguile/vectors.c index cd194a905..36ffda380 100644 --- a/libguile/vectors.c +++ b/libguile/vectors.c @@ -83,8 +83,8 @@ SCM_REGISTER_PROC (s_list_to_vector, "list->vector", 1, 0, 0, scm_vector); */ SCM_DEFINE (scm_vector, "vector", 0, 0, 1, (SCM l), - "@deffnx primitive list->vector l\n" - "Return a newly allocated vector whose elements contain the\n" + "@deffnx {Scheme Procedure} list->vector l\n" + "Return a newly allocated vector composed of the\n" "given arguments. Analogous to @code{list}.\n" "\n" "@lisp\n" @@ -173,8 +173,8 @@ scm_vector_set_x (SCM v, SCM k, SCM obj) SCM_DEFINE (scm_make_vector, "make-vector", 1, 1, 0, (SCM k, SCM fill), "Return a newly allocated vector of @var{k} elements. If a\n" - "second argument is given, then each element is initialized to\n" - "@var{fill}. Otherwise the initial contents of each element is\n" + "second argument is given, then each position is initialized to\n" + "@var{fill}. Otherwise the initial contents of each position is\n" "unspecified.") #define FUNC_NAME s_scm_make_vector { @@ -226,8 +226,7 @@ scm_c_make_vector (unsigned long int k, SCM fill) SCM_DEFINE (scm_vector_to_list, "vector->list", 1, 0, 0, (SCM v), - "Return a newly allocated list of the objects contained in the\n" - "elements of @var{vector}.\n" + "Return a newly allocated list composed of the elements of @var{v}.\n" "\n" "@lisp\n" "(vector->list '#(dah dah didah)) @result{} (dah dah didah)\n" @@ -248,7 +247,7 @@ SCM_DEFINE (scm_vector_to_list, "vector->list", 1, 0, 0, SCM_DEFINE (scm_vector_fill_x, "vector-fill!", 2, 0, 0, (SCM v, SCM fill), - "Store @var{fill} in every element of @var{vector}. The value\n" + "Store @var{fill} in every position of @var{vector}. The value\n" "returned by @code{vector-fill!} is unspecified.") #define FUNC_NAME s_scm_vector_fill_x { diff --git a/libguile/version.c b/libguile/version.c index e1c40b65b..b99d77710 100644 --- a/libguile/version.c +++ b/libguile/version.c @@ -94,9 +94,9 @@ SCM_DEFINE (scm_micro_version, "micro-version", 0, 0, 0, SCM_DEFINE (scm_version, "version", 0, 0, 0, (), - "@deffnx primitive major-version\n" - "@deffnx primitive minor-version\n" - "@deffnx primitive micro-version\n" + "@deffnx {Scheme Procedure} major-version\n" + "@deffnx {Scheme Procedure} minor-version\n" + "@deffnx {Scheme Procedure} micro-version\n" "Return a string describing Guile's version number, or its major, minor\n" "or micro version number, respectively.\n\n" "@lisp\n" diff --git a/libguile/weaks.c b/libguile/weaks.c index d8eb065cd..74ce39703 100644 --- a/libguile/weaks.c +++ b/libguile/weaks.c @@ -124,7 +124,7 @@ SCM_REGISTER_PROC(s_list_to_weak_vector, "list->weak-vector", 1, 0, 0, scm_weak_ SCM_DEFINE (scm_weak_vector, "weak-vector", 0, 0, 1, (SCM l), - "@deffnx primitive list->weak-vector l\n" + "@deffnx {Scheme Procedure} list->weak-vector l\n" "Construct a weak vector from a list: @code{weak-vector} uses\n" "the list of its arguments while @code{list->weak-vector} uses\n" "its only argument @var{l} (a list) to construct a weak vector\n" @@ -167,8 +167,8 @@ SCM_DEFINE (scm_weak_vector_p, "weak-vector?", 1, 0, 0, SCM_DEFINE (scm_make_weak_key_hash_table, "make-weak-key-hash-table", 1, 0, 0, (SCM size), - "@deffnx primitive make-weak-value-hash-table size\n" - "@deffnx primitive make-doubly-weak-hash-table size\n" + "@deffnx {Scheme Procedure} make-weak-value-hash-table size\n" + "@deffnx {Scheme Procedure} make-doubly-weak-hash-table size\n" "Return a weak hash table with @var{size} buckets. As with any\n" "hash table, choosing a good size for the table requires some\n" "caution.\n" @@ -206,8 +206,8 @@ SCM_DEFINE (scm_make_doubly_weak_hash_table, "make-doubly-weak-hash-table", 1, 0 SCM_DEFINE (scm_weak_key_hash_table_p, "weak-key-hash-table?", 1, 0, 0, (SCM obj), - "@deffnx primitive weak-value-hash-table? obj\n" - "@deffnx primitive doubly-weak-hash-table? obj\n" + "@deffnx {Scheme Procedure} weak-value-hash-table? obj\n" + "@deffnx {Scheme Procedure} doubly-weak-hash-table? obj\n" "Return @code{#t} if @var{obj} is the specified weak hash\n" "table. Note that a doubly weak hash table is neither a weak key\n" "nor a weak value hash table.") diff --git a/scripts/ChangeLog b/scripts/ChangeLog index 01dd7eb19..87be0b25a 100644 --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,11 @@ 2001-11-16 Neil Jerram <neil@ossau.uklinux.net> + * snarf-check-and-output-texi: Change generated @deffn categories + from "function" and "primitive" to "C Function" and "Scheme + Procedure". + (end-multiline): Take out @findex generation again; not needed + since index entries are implicit in @deffn forms. + These changes add a @deffnx C function declaration and function index entries for each Guile primitive to the copy of the doc snarf output that is used for reference manual synchronization. diff --git a/scripts/snarf-check-and-output-texi b/scripts/snarf-check-and-output-texi index f6ca78757..37d751c86 100755 --- a/scripts/snarf-check-and-output-texi +++ b/scripts/snarf-check-and-output-texi @@ -143,7 +143,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" (set! *sig* #f) (set! *docstring* #f)) -(define *primitive-deffnx-signature* "@deffnx primitive ") +(define *primitive-deffnx-signature* "@deffnx {Scheme Procedure} ") (define *primitive-deffnx-sig-length* (string-length *primitive-deffnx-signature*)) (define (end-multiline) @@ -184,18 +184,18 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" (if (and *manual-flag* (eq? *snarf-type* 'primitive)) (with-output-to-string (lambda () - (format #t "@deffnx function SCM ~A (" *c-function-name*) + (format #t "@deffnx {C Function} ~A (" *c-function-name*) (unless (null? *args*) - (format #t "SCM ~A" (car *args*)) + (format #t "~A" (car *args*)) (let loop ((args (cdr *args*))) (unless (null? args) - (format #t ", SCM ~A" (car args)) + (format #t ", ~A" (car args)) (loop (cdr args))))) (format #t ")\n"))) #f))) (format #t "\n~A\n" *function-name*) (format #t "@c snarfed from ~A:~A\n" *file* *line*) - (format #t "@deffn primitive ~A\n" nice-sig) + (format #t "@deffn {Scheme Procedure} ~A\n" nice-sig) (let loop ((strings *docstring*) (scm-deffnx scm-deffnx)) (cond ((null? strings)) ((or (not scm-deffnx) @@ -209,9 +209,6 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" (else (display scm-deffnx) (loop strings #f)))) (display "\n") - (when *manual-flag* - (format #t "@findex ~A\n" *function-name*) - (format #t "@findex ~A\n" *c-function-name*)) (display "@end deffn\n")))) (define (texi-quote s) |