diff options
author | Dirk Herrmann <dirk@dirk-herrmanns-seiten.de> | 2001-10-05 20:18:30 +0000 |
---|---|---|
committer | Dirk Herrmann <dirk@dirk-herrmanns-seiten.de> | 2001-10-05 20:18:30 +0000 |
commit | 11d49f5489a88c3fa5f51993849f342db2c4bc4b (patch) | |
tree | 09ee085c47c285c44615a813ddf2423fe9870c4b /libguile/options.h | |
parent | 3dbacabc55535dcff956db1d40c5f6d85973176f (diff) | |
download | guile-11d49f5489a88c3fa5f51993849f342db2c4bc4b.tar.gz |
* options.c (protected_objects, scm_init_options): The content of
protected_objects is now protected from garbage collection using
scm_gc_register_root instead of scm_permanent_object.
(get_option_setting): New static function that computes an option
setting as it was formerly done in the function scm_options.
(get_documented_option_setting): New static function that
returns option documentation as it was formerly done in the
function scm_options. Note that documentation C strings are no
longer precomputed into SCM objects. Instead, they are converted
into SCM strings every time get_documented_option_setting is
called.
(change_option_setting): New static functions that modifies the
option setting as it was formerly done in the function
scm_options. The function is now exception safe, i. e. won't
cause a memory leak when interrupted. Further, only non-immediate
option values are added to the protection list.
(scm_options): This function now has only the purpose to dispatch
to to get_option_setting, get_documented_option_setting or
change_option_setting, depending on the arguments given to
scm_options.
(scm_init_opts): Don't convert documentation C strings into SCM
strings. Further, don't protect any object values: They _must_
be immediate values, otherwise there is no guarantee that they
have not been collected before anyway.
* options.[ch] (scm_t_option): Made type unsigned, name into a
constant char* and val into a scm_t_bits type.
(scm_options, scm_init_opts): The number of options is guaranteed
to be larger or equal to zero. Thus, the type is changed to
unsigned.
Diffstat (limited to 'libguile/options.h')
-rw-r--r-- | libguile/options.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libguile/options.h b/libguile/options.h index 98f21c464..3ab28cb69 100644 --- a/libguile/options.h +++ b/libguile/options.h @@ -55,14 +55,9 @@ typedef struct scm_t_option { - int type; - char *name; - - /* - schizophrenic use: both SCM and int - */ - unsigned long val; - /* SCM val */ + unsigned int type; + const char *name; + scm_t_bits val; char *doc; } scm_t_option; @@ -72,8 +67,8 @@ typedef struct scm_t_option #define SCM_OPTION_SCM 2 -extern SCM scm_options (SCM new_mode, scm_t_option options[], int n, const char *s); -extern void scm_init_opts (SCM (*func) (SCM), scm_t_option options[], int n); +extern SCM scm_options (SCM, scm_t_option [], unsigned int, const char*); +extern void scm_init_opts (SCM (*) (SCM), scm_t_option [], unsigned int n); extern void scm_init_options (void); #endif /* SCM_OPTIONS_H */ |