diff options
author | Neil Jerram <neil@ossau.uklinux.net> | 2005-10-15 18:33:34 +0000 |
---|---|---|
committer | Neil Jerram <neil@ossau.uklinux.net> | 2005-10-15 18:33:34 +0000 |
commit | 777f2ed60a04d67d8a966ecb95a809d696a1307b (patch) | |
tree | 0f7c1d238f35cb51b9dadcc38f445bc9c7ee6806 /doc/ref/api-debug.texi | |
parent | a373f81dda547b0d89105b2cf68a0051bbf887a3 (diff) | |
download | guile-777f2ed60a04d67d8a966ecb95a809d696a1307b.tar.gz |
* api-debug.texi (Source Properties): Add text describing/advising
limited use of source properties.
* api-debug.texi (Source Properties): Documentation of source
property procedures moved here from ...
* api-procedures.texi (Procedure Properties): ... where it didn't
belong.
Diffstat (limited to 'doc/ref/api-debug.texi')
-rw-r--r-- | doc/ref/api-debug.texi | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/doc/ref/api-debug.texi b/doc/ref/api-debug.texi index adf40af61..458ea034e 100644 --- a/doc/ref/api-debug.texi +++ b/doc/ref/api-debug.texi @@ -161,6 +161,60 @@ named ``positions'' (@pxref{Reader options}). This option is switched interactively; all these options are @emph{off} by default when Guile runs a script non-interactively. +The following procedures can be used to access and set the source +properties of read expressions. + +@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 {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 {Scheme Procedure} source-properties obj +@deffnx {C Function} scm_source_properties (obj) +Return the source property association list of @var{obj}. +@end deffn + +@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 + +In practice there are only two ways that you should use the ability to +set an expression's source breakpoints. + +@itemize +@item +To set a breakpoint on an expression, use @code{(set-source-property! +@var{expr} 'breakpoint #t)}. If you do this, you should also set the +@code{traps} and @code{enter-frame-handler} trap options +(@pxref{Evaluator trap options}) and @code{breakpoints} debug option +(@pxref{Debugger options}) appropriately, and the evaluator will then +call your enter frame handler whenever it is about to evaluate that +expression. + +@item +To make a read or constructed expression appear to have come from a +different source than what the expression's source properties already +say, you can use @code{set-source-property!} to set the expression's +@code{filename}, @code{line} and @code{column} properties. The +properties that you set will then show up later if that expression is +involved in a backtrace or error report. +@end itemize + +If you are looking for a way to attach arbitrary information to an +expression other than these properties, you should use +@code{make-object-property} instead (@pxref{Object Properties}), because +that will avoid bloating the source property hash table, which is really +only intended for the specific purposes described in this section. + @node Using Traps @subsection Using Traps |