#include <toplev.h>
#include "aop.h"
+#include "aop-dynval.h"
#include "aop-type.h"
static struct aop_type _aop_t_all_signed = {
return get_dedup_type (&pointer_type);
}
+/**
+ * Check if an #aop_type object matches a pointer type. This check is
+ * true if and only if the specified type matches a subset of types
+ * that aop_t_all_pointer() matches.
+ * \param type The type to check.
+ * \param Non-zero if the #aop_type object matches a pointer type,
+ * zero otherwise.
+ */
+int
+aop_is_pointer_type (const struct aop_type *type)
+{
+ return (type->kind == ATK_ALL_POINTER || type->pointer_levels > 0);
+}
+
+/**
+ * Modify an #aop_dynval object so that it will be passed to advice as
+ * if it were matched and captured using the aop_t_all_pointer() type.
+ * Casting is useful if you wish to capture values from pointcuts
+ * matched with different aop_type objects but pass those values to
+ * the same advice function.
+ *
+ * Only use this function on dynvals whose type passes
+ * aop_is_pointer_type(). Casting a non-pointer type with this
+ * function will raise a fatal compiler error.
+ * \param dv The #aop_dynval to cast.
+ */
+void
+aop_cast_to_all_pointer (struct aop_dynval *dv)
+{
+ if (!aop_is_pointer_type (dv->type))
+ fatal_error ("(InterAsepct) Illegal cast to all pointer type.");
+
+ dv->type = aop_t_all_pointer ();
+}
+
+/**
+ * Get the type for an #aop_dynval object. Every dynval has an
+ * associated type that is determined by how it was matched and
+ * captured.
+ * \return The type of the specified dynval.
+ */
+const struct aop_type *aop_get_dynval_type (struct aop_dynval *dv)
+{
+ return dv->type;
+}
+
/* Close Doxygen defgroup block. */
/**
* \}
extern const struct aop_type *aop_t_enum (const char *tag);
extern const struct aop_type *aop_t_pointer_to (const struct aop_type *type);
+extern int aop_is_pointer_type (const struct aop_type *type);
+extern void aop_cast_to_all_pointer (struct aop_dynval *dv);
+
+extern const struct aop_type *aop_get_dynval_type (struct aop_dynval *dv);
+
extern void aop_register_pass (const char *pass_name, pass_callback callback);
extern void aop_join_on (struct aop_pointcut *pc, join_callback callback,
void *callback_param);