From 8a6084d6aa722eb8e87aa7dd01ee4623c2fee2cc Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 11 Nov 2008 10:30:46 +0100 Subject: [PATCH] write the rest of the documentation 100% coverage again \o/ --- doc/swfdec-sections.txt | 22 ++++++++++++++ swfdec/swfdec_as_object.c | 42 ++++++++++++++++++++++++++ swfdec/swfdec_as_types.c | 77 +++++++++++++++++++++++++++++++++++++++++------ swfdec/swfdec_as_types.h | 2 +- 4 files changed, 133 insertions(+), 10 deletions(-) diff --git a/doc/swfdec-sections.txt b/doc/swfdec-sections.txt index 4bbc1918..a7f9bf62 100644 --- a/doc/swfdec-sections.txt +++ b/doc/swfdec-sections.txt @@ -391,6 +391,7 @@ SwfdecGcObject SwfdecGcObjectClass swfdec_gc_object_get_context swfdec_gc_object_mark +swfdec_as_object_mark swfdec_as_string_mark swfdec_as_value_mark @@ -408,21 +409,32 @@ SWFDEC_TYPE_GC_OBJECT SwfdecAsValue SwfdecAsValueType SwfdecAsValue +SWFDEC_AS_VALUE_GET_TYPE +SWFDEC_AS_VALUE_UNDEFINED SWFDEC_AS_VALUE_SET_UNDEFINED +SWFDEC_AS_VALUE_FALSE +SWFDEC_AS_VALUE_TRUE +SWFDEC_AS_VALUE_FROM_BOOLEAN SWFDEC_AS_VALUE_GET_BOOLEAN swfdec_as_value_to_boolean SWFDEC_AS_VALUE_SET_BOOLEAN SWFDEC_AS_VALUE_GET_NUMBER +swfdec_as_value_from_number swfdec_as_value_to_number +swfdec_as_value_from_integer swfdec_as_value_to_integer +SWFDEC_AS_VALUE_FROM_STRING SWFDEC_AS_VALUE_GET_STRING swfdec_as_value_to_string SWFDEC_AS_VALUE_SET_STRING +SWFDEC_AS_VALUE_NULL SWFDEC_AS_VALUE_SET_NULL +SWFDEC_AS_VALUE_FROM_OBJECT SWFDEC_AS_VALUE_GET_OBJECT swfdec_as_value_to_object SWFDEC_AS_VALUE_SET_OBJECT swfdec_as_value_to_primitive +swfdec_as_value_get_variable swfdec_as_double_to_integer swfdec_as_double_to_string swfdec_as_integer_to_string @@ -434,6 +446,13 @@ SWFDEC_AS_VALUE_IS_NUMBER SWFDEC_AS_VALUE_IS_STRING SWFDEC_AS_VALUE_IS_NULL SWFDEC_AS_VALUE_IS_OBJECT +SWFDEC_AS_VALUE_COMBINE +SWFDEC_AS_VALUE_TYPE_BITS +SWFDEC_AS_VALUE_TYPE_MASK +SWFDEC_AS_VALUE_VALUE_MASK +SWFDEC_AS_VALUE_GET_VALUE +SwfdecAsDoubleValue +SwfdecAsStringValue
@@ -489,6 +508,9 @@ SwfdecAsVariableForeach swfdec_as_object_foreach swfdec_as_object_run swfdec_as_object_call +swfdec_as_object_set_constructor_by_name +swfdec_as_object_set_constructor_by_namev +swfdec_as_object_set_relay swfdec_as_object_add_function swfdec_as_object_resolve
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c index fc91eab7..6e9ab928 100644 --- a/swfdec/swfdec_as_object.c +++ b/swfdec/swfdec_as_object.c @@ -228,6 +228,13 @@ swfdec_as_object_mark_watch (gpointer key, gpointer value, gpointer unused) swfdec_as_value_mark (&watch->watch_data); } +/** + * swfdec_as_object_mark: + * @object: the object to mark + * + * Mark @object as being in use. Calling this function is only valid during + * the marking phase of garbage collection. + **/ void swfdec_as_object_mark (SwfdecAsObject *object) { @@ -1300,6 +1307,20 @@ swfdec_as_object_create (SwfdecAsFunction *fun, guint n_args, swfdec_as_function_call_full (fun, new, TRUE, new->prototype, n_args, args, return_value); } +/** + * swfdec_as_object_set_constructor_by_name: + * @object: the object to set a constructor on + * @name: first variable name for getting the constructor + * @...: %NULL-terminated list of further variables to get + * + * Sets the constructor of @object to be the objet you get when you get the + * variables given by @name and further arguments on the global object. It is + * equivalent to calling swfdec_as_object_get_variable() with the names first + * and then calling swfdec_as_object_set_constructor() on @object with the + * final result. + * + * Returns: The actual constructor that was set or %NULL on failure + **/ SwfdecAsObject * swfdec_as_object_set_constructor_by_name (SwfdecAsObject *object, const char *name, ...) { @@ -1315,6 +1336,17 @@ swfdec_as_object_set_constructor_by_name (SwfdecAsObject *object, const char *na return ret; } +/** + * swfdec_as_object_set_constructor_by_namev: + * @object: the object to set a constructor on + * @name: first variable name for getting the constructor + * @args: va_list of further name arguments + * + * This is the va_list version of swfdec_as_object_set_constructor_by_name(). + * See that function for details. + * + * Returns: The actual constructor that was set or %NULL on failure + **/ SwfdecAsObject * swfdec_as_object_set_constructor_by_namev (SwfdecAsObject *object, const char *name, va_list args) @@ -1785,10 +1817,20 @@ swfdec_as_object_resolve (SwfdecAsObject *object) return object; } +/** + * swfdec_as_object_set_relay: + * @object: The object to set a new relay on + * @relay: The relay to set + * + * Associates @object and @relay. This allows you to associate your own data + * with a given #SwfdecAsObject, so you can write native functions making use + * of this. See #SwfdecAsRelay documentation for details about relays. + **/ void swfdec_as_object_set_relay (SwfdecAsObject *object, SwfdecAsRelay *relay) { g_return_if_fail (object != NULL); + if (relay) { g_return_if_fail (SWFDEC_IS_AS_RELAY (relay)); g_return_if_fail (relay->relay == NULL); diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c index ce71eccd..5432ade7 100644 --- a/swfdec/swfdec_as_types.c +++ b/swfdec/swfdec_as_types.c @@ -84,9 +84,21 @@ * * This is the type used to present an opaque value in the Actionscript * engine. See #SwfdecAsValueType for possible types. It's similar in - * spirit to #GValue. The value held is garbage-collected. Apart from the type - * member, use the provided macros to access this structure. - * If you memset a SwfdecAsValue to 0, it is a valid undefined value. + * spirit to #GValue. Use the provided macros to access this structure. + */ + +/** + * SWFDEC_AS_VALUE_GET_TYPE: + * @val: The value to extract the type from + * + * Extracts the type from a given value. + */ + +/** + * SWFDEC_AS_VALUE_UNDEFINED: + * + * The special "undefined" value. Use SWFDEC_AS_VALUE_IS_UNDEFINED() to + * check if a value equals this value. */ /** @@ -98,6 +110,18 @@ */ /** + * SWFDEC_AS_VALUE_FALSE: + * + * The boolean value false. + */ + +/** + * SWFDEC_AS_VALUE_TRUE: + * + * The boolean value true. + */ + +/** * SWFDEC_AS_VALUE_GET_BOOLEAN: * @val: value to get, the value must reference a boolean * @@ -108,6 +132,17 @@ */ /** + * SWFDEC_AS_VALUE_FROM_BOOLEAN: + * @b: boolean to convert + * + * Converts the given value to a boolean #SwfdecAsValue. When knowing the value + * at compile-time, use the static values such as %SWFDEC_AS_VALUE_TRUE instead + * of SWFDEC_AS_VALUE_FROM_BOOLEAN(%TRUE). + * + * Returns: %SWFDEC_AS_VALUE_TRUE or %SWFDEC_AS_VALUE_FALSE + */ + +/** * SWFDEC_AS_VALUE_SET_BOOLEAN: * @val: value to set * @b: boolean value to set, must be either %TRUE or %FALSE @@ -137,6 +172,15 @@ */ /** + * SWFDEC_AS_VALUE_FROM_STRING: + * @s: garbage-collected string to convert + * + * Converts the given string to a #SwfdecAsValue. + * + * Returns: a SwfdecAsValue representing the given string + */ + +/** * SWFDEC_AS_VALUE_SET_STRING: * @val: value to set * @s: garbage-collected string to use @@ -145,6 +189,13 @@ */ /** + * SWFDEC_AS_VALUE_NULL: + * + * The special "null" value. Use SWFDEC_AS_VALUE_IS_NULL() to + * check if a value equals this value. + */ + +/** * SWFDEC_AS_VALUE_SET_NULL: * @val: value to set * @@ -162,6 +213,15 @@ */ /** + * SWFDEC_AS_VALUE_FROM_OBJECT: + * @o: the #SwfdecAsObject to convert + * + * Converts the given object to a #SwfdecAsValue. + * + * Returns: a SwfdecAsValue representing the given object + */ + +/** * SWFDEC_AS_VALUE_SET_OBJECT: * @val: value to set * @o: garbage-collected #SwfdecAsObject to use @@ -173,20 +233,19 @@ /*** actual code ***/ /** - * swfdec_as_value_set_int: - * @val: value to set + * swfdec_as_value_from_integer: + * @cx: The context to use * @i: integer value to set * * Creates a garbage-collected value representing @i and returns it. - * Sets @val to the given value. Currently this function is a macro that calls - * swfdec_as_value_set_number(), but this may change in future versions of - * Swfdec. + * Currently this function is a macro that calls swfdec_as_value_set_number(), + * but this may change in future versions of Swfdec. * * Returns: The new value representing @i */ /** - * swfdec_as_value_set_number: + * swfdec_as_value_from_number: * @context: The context to use * @number: double value to set * diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h index b5a96e33..b668bb0d 100644 --- a/swfdec/swfdec_as_types.h +++ b/swfdec/swfdec_as_types.h @@ -139,7 +139,7 @@ const char * swfdec_as_str_concat (SwfdecAsContext * cx, /* variable get/set */ void swfdec_as_value_get_variable (SwfdecAsContext * cx, - const SwfdecAsValue * val, + const SwfdecAsValue * value, const char * name, SwfdecAsValue * ret); -- 2.11.4.GIT