diff options
| -rw-r--r-- | doc/configurable.n | 2 | ||||
| -rw-r--r-- | generic/tclOOCall.c | 82 |
2 files changed, 71 insertions, 13 deletions
diff --git a/doc/configurable.n b/doc/configurable.n index dd1e09e..6477894 100644 --- a/doc/configurable.n +++ b/doc/configurable.n @@ -62,7 +62,7 @@ If passed no additional arguments, the \fBconfigure\fR method returns an alphabetically sorted dictionary of all \fIreadable\fR and \fIread-write\fR properties and their current values. .PP -If passed a single addiional argument, that argument to the \fBconfigure\fR +If passed a single additional argument, that argument to the \fBconfigure\fR method must be the name of a property to read (or an unambiguous prefix thereof); its value is returned. .PP diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 5a0eeea..57f8860 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -2110,11 +2110,24 @@ AddDefinitionNamespaceToChain( definePtr->num++; } +/* + * ---------------------------------------------------------------------- + * + * FindClassProps -- + * + * Discover the properties known to a class and its superclasses. + * The property names become the keys in the accumulator hash table + * (which is used as a set). + * + * ---------------------------------------------------------------------- + */ + static void FindClassProps( - Class *clsPtr, - int writable, - Tcl_HashTable *accumulator) + Class *clsPtr, /* The object to inspect. Must exist. */ + int writable, /* Whether we're after the readable or writable + * property set. */ + Tcl_HashTable *accumulator) /* Where to gather the names. */ { int i, dummy; Tcl_Obj *propName; @@ -2148,11 +2161,24 @@ FindClassProps( } } +/* + * ---------------------------------------------------------------------- + * + * FindObjectProps -- + * + * Discover the properties known to an object and all its classes. + * The property names become the keys in the accumulator hash table + * (which is used as a set). + * + * ---------------------------------------------------------------------- + */ + static void FindObjectProps( - Object *oPtr, - int writable, - Tcl_HashTable *accumulator) + Object *oPtr, /* The object to inspect. Must exist. */ + int writable, /* Whether we're after the readable or writable + * property set. */ + Tcl_HashTable *accumulator) /* Where to gather the names. */ { int i, dummy; Tcl_Obj *propName; @@ -2173,11 +2199,27 @@ FindObjectProps( FindClassProps(oPtr->selfCls, writable, accumulator); } +/* + * ---------------------------------------------------------------------- + * + * TclOOGetAllClassProperties -- + * + * Get the list of all properties known to a class, including to its + * superclasses. Manages a cache so this operation is usually cheap. + * The order of properties in the resulting list is undefined. + * + * ---------------------------------------------------------------------- + */ + Tcl_Obj * TclOOGetAllClassProperties( - Class *clsPtr, - int writable, - int *allocated) + Class *clsPtr, /* The class to inspect. Must exist. */ + int writable, /* Whether to get writable properties. If + * false, readable properties will be returned + * instead. */ + int *allocated) /* Address of variable to set to true if a + * Tcl_Obj was allocated and may be safely + * modified by the caller. */ { Tcl_HashTable hashTable; FOREACH_HASH_DECLS; @@ -2239,11 +2281,27 @@ TclOOGetAllClassProperties( return result; } +/* + * ---------------------------------------------------------------------- + * + * TclOOGetAllObjectProperties -- + * + * Get the list of all properties known to a object, including to its + * classes. Manages a cache so this operation is usually cheap. + * The order of properties in the resulting list is undefined. + * + * ---------------------------------------------------------------------- + */ + Tcl_Obj * TclOOGetAllObjectProperties( - Object *oPtr, - int writable, - int *allocated) + Object *oPtr, /* The object to inspect. Must exist. */ + int writable, /* Whether to get writable properties. If + * false, readable properties will be returned + * instead. */ + int *allocated) /* Address of variable to set to true if a + * Tcl_Obj was allocated and may be safely + * modified by the caller. */ { Tcl_HashTable hashTable; FOREACH_HASH_DECLS; |
