From 7e7af7f21b42d02e74f52576a8ac163b65e021b4 Mon Sep 17 00:00:00 2001 From: siboud Date: Fri, 8 Apr 2005 00:53:16 +0000 Subject: [PATCH] filter core, text module and gui module: - applied further documentation to all modules - generated doxygen documentation for filter modules git-svn-id: http://ltt.polymtl.ca/svn@919 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/filter.c | 194 ++++++++---------- ltt/branches/poly/lttv/lttv/filter.h | 191 ++++++++--------- .../poly/lttv/modules/gui/filter/filter.c | 130 ++++++------ .../poly/lttv/modules/text/textFilter.c | 16 +- 4 files changed, 258 insertions(+), 273 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index b9668ec3..2fc76a0a 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -16,72 +16,52 @@ * MA 02111-1307, USA. */ -/* - read_token - - read_expression - ( read expr ) - simple expr [ op expr ] - - read_simple_expression - read_field_path [ rel value ] - - read_field_path - read_field_component [. field path] - - read_field_component - name [ \[ value \] ] - - data struct: - and/or(left/right) - not(child) - op(left/right) - path(component...) -> field - - consist in AND, OR and NOT nested expressions, forming a tree with - simple relations as leaves. The simple relations test is a field - in an event is equal, not equal, smaller, smaller or equal, larger, or - larger or equal to a specified value. -*/ - -/* - * YET TO BE ANSWERED - * - none yet +/*! \file lttv/lttv/filter.c + * \brief Defines the core filter of application + * + * consist in AND, OR and NOT nested expressions, forming a tree with + * simple relations as leaves. The simple relations test if a field + * in an event is equal, not equal, smaller, smaller or equal, larger, or + * larger or equal to a specified value. + * + * Fields specified in a simple expression can take following + * values + * + * LttvTracefileContext{}\ + * |->event\ + * | |->name (String, converted to GQuark) + * | |->category (String, not yet implemented) + * | |->time (LttTime) + * | |->tsc (LttCycleCount) + * | |->fields + * | |->"event name" + * | |->"field name" + * | |->"sub-field name" + * | |->... + * | |->"leaf-field name" (field type) + * |->tracefile + * | |->name (String, converted to GQuark) + * |->trace + * | |->name (String, converted to GQuark) + * |->state + * |->pid (uint64) + * |->ppid (uint64) + * |->creation_time (LttTime) + * |->insertion_time (LttTime) + * |->process_name (String, converted to GQuark) + * |->execution_mode (LttvExecutionMode) + * |->execution_submode (LttvExecutionSubmode) + * |->process_status (LttvProcessStatus) + * |->cpu (GQuark) */ /* * TODO * - refine switch of expression in multiple uses functions * - remove the idle expressions in the tree **** - * - add the current simple expression to the tree - * * clear the field_path array after use */ #include -#include - -/* -GQuark - LTTV_FILTER_TRACE, - LTTV_FILTER_TRACESET, - LTTV_FILTER_TRACEFILE, - LTTV_FILTER_STATE, - LTTV_FILTER_EVENT, - LTTV_FILTER_NAME, - LTTV_FILTER_CATEGORY, - LTTV_FILTER_TIME, - LTTV_FILTER_TSC, - LTTV_FILTER_PID, - LTTV_FILTER_PPID, - LTTV_FILTER_C_TIME, - LTTV_FILTER_I_TIME, - LTTV_FILTER_P_NAME, - LTTV_FILTER_EX_MODE, - LTTV_FILTER_EX_SUBMODE, - LTTV_FILTER_P_STATUS, - LTTV_FILTER_CPU; -*/ - /** * @fn LttvSimpleExpression* lttv_simple_expression_new() @@ -102,7 +82,7 @@ lttv_simple_expression_new() { } /** - * @fn gboolean lttv_simple_expression_add_field(GPtrArray*,LttvSimpleExpression*) + * @fn gboolean lttv_simple_expression_assign_field(GPtrArray*,LttvSimpleExpression*) * * Parse through filtering field hierarchy as specified * by user. This function compares each value to @@ -249,6 +229,7 @@ lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) { * Sets the function pointer for the current * Simple Expression * @param se current simple expression + * @param op current operator * @return success/failure of operation */ gboolean lttv_simple_expression_assign_operator(LttvSimpleExpression* se, LttvExpressionOp op) { @@ -346,7 +327,7 @@ gboolean lttv_simple_expression_assign_operator(LttvSimpleExpression* se, LttvEx } /** - * @fn void lttv_simple_expression_assign_value(LttvSimpleExpression*,char*) + * @fn gboolean lttv_simple_expression_assign_value(LttvSimpleExpression*,char*) * * Assign the value field to the current LttvSimpleExpression * @param se pointer to the current LttvSimpleExpression @@ -491,7 +472,7 @@ lttv_struct_type(gint ft) { } /** - * @fn gboolean lttv_apply_op_eq_uint64(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_eq_uint64(gpointer,LttvFieldValue) * * Applies the 'equal' operator to the * specified structure and value @@ -507,7 +488,7 @@ gboolean lttv_apply_op_eq_uint64(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_eq_uint32(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_eq_uint32(gpointer,LttvFieldValue) * * Applies the 'equal' operator to the * specified structure and value @@ -521,7 +502,7 @@ gboolean lttv_apply_op_eq_uint32(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_eq_uint16(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_eq_uint16(gpointer,LttvFieldValue) * * Applies the 'equal' operator to the * specified structure and value @@ -535,7 +516,7 @@ gboolean lttv_apply_op_eq_uint16(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_eq_double(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_eq_double(gpointer,LttvFieldValue) * * Applies the 'equal' operator to the * specified structure and value @@ -549,7 +530,7 @@ gboolean lttv_apply_op_eq_double(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_eq_string(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_eq_string(gpointer,LttvFieldValue) * * Applies the 'equal' operator to the * specified structure and value @@ -563,7 +544,7 @@ gboolean lttv_apply_op_eq_string(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_eq_quark(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_eq_quark(gpointer,LttvFieldValue) * * Applies the 'equal' operator to the * specified structure and value @@ -578,7 +559,7 @@ gboolean lttv_apply_op_eq_quark(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_eq_ltttime(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_eq_ltttime(gpointer,LttvFieldValue) * * Applies the 'equal' operator to the * specified structure and value @@ -594,7 +575,7 @@ gboolean lttv_apply_op_eq_ltttime(const gpointer v1, LttvFieldValue v2) { /** - * @fn gboolean lttv_apply_op_ne_uint64(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ne_uint64(gpointer,LttvFieldValue) * * Applies the 'not equal' operator to the * specified structure and value @@ -608,7 +589,7 @@ gboolean lttv_apply_op_ne_uint64(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_ne_uint32(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ne_uint32(gpointer,LttvFieldValue) * * Applies the 'not equal' operator to the * specified structure and value @@ -622,7 +603,7 @@ gboolean lttv_apply_op_ne_uint32(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_ne_uint16(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ne_uint16(gpointer,LttvFieldValue) * * Applies the 'not equal' operator to the * specified structure and value @@ -636,7 +617,7 @@ gboolean lttv_apply_op_ne_uint16(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_ne_double(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ne_double(gpointer,LttvFieldValue) * * Applies the 'not equal' operator to the * specified structure and value @@ -650,7 +631,7 @@ gboolean lttv_apply_op_ne_double(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_ne_string(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ne_string(gpointer,LttvFieldValue) * * Applies the 'not equal' operator to the * specified structure and value @@ -664,7 +645,7 @@ gboolean lttv_apply_op_ne_string(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_ne_quark(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ne_quark(gpointer,LttvFieldValue) * * Applies the 'not equal' operator to the * specified structure and value @@ -679,7 +660,7 @@ gboolean lttv_apply_op_ne_quark(const gpointer v1, LttvFieldValue v2) { /** - * @fn gboolean lttv_apply_op_ne_ltttime(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ne_ltttime(gpointer,LttvFieldValue) * * Applies the 'not equal' operator to the * specified structure and value @@ -694,7 +675,7 @@ gboolean lttv_apply_op_ne_ltttime(const gpointer v1, LttvFieldValue v2) { /** - * @fn gboolean lttv_apply_op_lt_uint64(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_lt_uint64(gpointer,LttvFieldValue) * * Applies the 'lower than' operator to the * specified structure and value @@ -708,7 +689,7 @@ gboolean lttv_apply_op_lt_uint64(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_lt_uint32(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_lt_uint32(gpointer,LttvFieldValue) * * Applies the 'lower than' operator to the * specified structure and value @@ -722,7 +703,7 @@ gboolean lttv_apply_op_lt_uint32(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_lt_uint16(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_lt_uint16(gpointer,LttvFieldValue) * * Applies the 'lower than' operator to the * specified structure and value @@ -736,7 +717,7 @@ gboolean lttv_apply_op_lt_uint16(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_lt_double(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_lt_double(gpointer,LttvFieldValue) * * Applies the 'lower than' operator to the * specified structure and value @@ -750,7 +731,7 @@ gboolean lttv_apply_op_lt_double(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_lt_ltttime(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_lt_ltttime(gpointer,LttvFieldValue) * * Applies the 'lower than' operator to the * specified structure and value @@ -766,7 +747,7 @@ gboolean lttv_apply_op_lt_ltttime(const gpointer v1, LttvFieldValue v2) { /** - * @fn gboolean lttv_apply_op_le_uint64(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_le_uint64(gpointer,LttvFieldValue) * * Applies the 'lower or equal' operator to the * specified structure and value @@ -780,7 +761,7 @@ gboolean lttv_apply_op_le_uint64(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_le_uint32(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_le_uint32(gpointer,LttvFieldValue) * * Applies the 'lower or equal' operator to the * specified structure and value @@ -794,7 +775,7 @@ gboolean lttv_apply_op_le_uint32(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_le_uint16(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_le_uint16(gpointer,LttvFieldValue) * * Applies the 'lower or equal' operator to the * specified structure and value @@ -808,7 +789,7 @@ gboolean lttv_apply_op_le_uint16(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_le_double(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_le_double(gpointer,LttvFieldValue) * * Applies the 'lower or equal' operator to the * specified structure and value @@ -822,7 +803,7 @@ gboolean lttv_apply_op_le_double(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_le_ltttime(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_le_ltttime(gpointer,LttvFieldValue) * * Applies the 'lower or equal' operator to the * specified structure and value @@ -838,7 +819,7 @@ gboolean lttv_apply_op_le_ltttime(const gpointer v1, LttvFieldValue v2) { /** - * @fn gboolean lttv_apply_op_gt_uint64(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_gt_uint64(gpointer,LttvFieldValue) * * Applies the 'greater than' operator to the * specified structure and value @@ -852,7 +833,7 @@ gboolean lttv_apply_op_gt_uint64(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_gt_uint32(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_gt_uint32(gpointer,LttvFieldValue) * * Applies the 'greater than' operator to the * specified structure and value @@ -866,7 +847,7 @@ gboolean lttv_apply_op_gt_uint32(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_gt_uint16(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_gt_uint16(gpointer,LttvFieldValue) * * Applies the 'greater than' operator to the * specified structure and value @@ -880,7 +861,7 @@ gboolean lttv_apply_op_gt_uint16(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_gt_double(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_gt_double(gpointer,LttvFieldValue) * * Applies the 'greater than' operator to the * specified structure and value @@ -894,7 +875,7 @@ gboolean lttv_apply_op_gt_double(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_gt_ltttime(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_gt_ltttime(gpointer,LttvFieldValue) * * Applies the 'greater than' operator to the * specified structure and value @@ -910,7 +891,7 @@ gboolean lttv_apply_op_gt_ltttime(const gpointer v1, LttvFieldValue v2) { /** - * @fn gboolean lttv_apply_op_ge_uint64(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ge_uint64(gpointer,LttvFieldValue) * * Applies the 'greater or equal' operator to the * specified structure and value @@ -924,7 +905,7 @@ gboolean lttv_apply_op_ge_uint64(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_ge_uint32(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ge_uint32(gpointer,LttvFieldValue) * * Applies the 'greater or equal' operator to the * specified structure and value @@ -938,7 +919,7 @@ gboolean lttv_apply_op_ge_uint32(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_ge_uint16(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ge_uint16(gpointer,LttvFieldValue) * * Applies the 'greater or equal' operator to the * specified structure and value @@ -952,7 +933,7 @@ gboolean lttv_apply_op_ge_uint16(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_ge_double(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ge_double(gpointer,LttvFieldValue) * * Applies the 'greater or equal' operator to the * specified structure and value @@ -966,7 +947,7 @@ gboolean lttv_apply_op_ge_double(const gpointer v1, LttvFieldValue v2) { } /** - * @fn gboolean lttv_apply_op_ge_ltttime(const gpointer,LttvFieldValue) + * @fn gboolean lttv_apply_op_ge_ltttime(gpointer,LttvFieldValue) * * Applies the 'greater or equal' operator to the * specified structure and value @@ -983,8 +964,6 @@ gboolean lttv_apply_op_ge_ltttime(const gpointer v1, LttvFieldValue v2) { /** - * @fn LttvFilterTree* lttv_filter_tree_clone(LttvFilterTree*) - * * Makes a copy of the current filter tree * @param tree pointer to the current tree * @return new copy of the filter tree @@ -1024,8 +1003,6 @@ lttv_filter_tree_clone(const LttvFilterTree* tree) { } /** - * @fn LttvFilter* lttv_filter_clone(LttvFilter*) - * * Makes a copy of the current filter * @param filter pointer to the current filter * @return new copy of the filter @@ -1035,7 +1012,6 @@ lttv_filter_clone(const LttvFilter* filter) { LttvFilter* newfilter = g_new(LttvFilter,1); - // newfilter->expression = g_new(char,1) strcpy(newfilter->expression,filter->expression); newfilter->head = lttv_filter_tree_clone(filter->head); @@ -1048,10 +1024,8 @@ lttv_filter_clone(const LttvFilter* filter) { /** * @fn LttvFilter* lttv_filter_new() * - * Creates a new lttv_filter - * @param expression filtering options string - * @param t pointer to the current LttvTrace - * @return the current lttv_filter or NULL if error + * Creates a new LttvFilter + * @return the current LttvFilter or NULL if error */ LttvFilter* lttv_filter_new() { @@ -1059,6 +1033,8 @@ lttv_filter_new() { LttvFilter* filter = g_new(LttvFilter,1); filter->expression = NULL; filter->head = NULL; + + return filter; } @@ -1520,11 +1496,9 @@ lttv_filter_tree_destroy(LttvFilterTree* tree) { } /** - * @fn gboolean lttv_filter_tree_parse(LttvFilterTree*,LttEvent,LttTracefile,LttTrace,LttvProcessState) - * * Global parsing function for the current * LttvFilterTree - * @param tree pointer to the current LttvFilterTree + * @param t pointer to the current LttvFilterTree * @param event current LttEvent, NULL if not used * @param tracefile current LttTracefile, NULL if not used * @param trace current LttTrace, NULL if not used @@ -1630,10 +1604,8 @@ lttv_filter_tree_parse( } /** - * @fn gboolean lttv_filter_tree_parse_branch(LttvFilterTree*,LttEvent*,LttTracefile*,LttTrace*,LttvProcessState*,LttvTracefileContext*) - * * This function parses a particular branch of the tree - * @param tree pointer to the current LttvFilterTree + * @param se pointer to the current LttvSimpleExpression * @param event current LttEvent, NULL if not used * @param tracefile current LttTracefile, NULL if not used * @param trace current LttTrace, NULL if not used @@ -1775,9 +1747,7 @@ gboolean lttv_filter_tree_parse_branch( /** - * @fn void lttv_print_tree(LttvFilterTree*) - * - * Debug + * Debug function. Prints tree memory allocation. * @param t the pointer to the current LttvFilterTree */ void @@ -1809,7 +1779,7 @@ static void module_init() } /** - * @fn Destroys the filter module and specific values + * Destroys the filter module and specific values */ static void module_destroy() { diff --git a/ltt/branches/poly/lttv/lttv/filter.h b/ltt/branches/poly/lttv/lttv/filter.h index 58a51818..33e4a138 100644 --- a/ltt/branches/poly/lttv/lttv/filter.h +++ b/ltt/branches/poly/lttv/lttv/filter.h @@ -19,6 +19,33 @@ #ifndef FILTER_H #define FILTER_H +/*! \file lttv/lttv/filter.h + * \brief Defines the core filter of application + * + * A filter expression consists in nested AND, OR and NOT expressions + * involving boolean relation (>, >=, =, !=, <, <=) between event fields and + * specific values. It is compiled into an efficient data structure which + * is used in functions to check if a given event or tracefile satisfies the + * filter. + * + * The grammar for filters is: + * + * filter = expression + * + * expression = "(" expression ")" | "!" expression | + * expression "&&" expression | expression "||" expression | + * simpleExpression + * + * simpleExpression = fieldPath op value + * + * fieldPath = fieldComponent [ "." fieldPath ] + * + * fieldComponent = name [ "[" integer "]" ] + * + * value = integer | double | string + */ + + #include #include #include @@ -27,31 +54,6 @@ #include #include - -/* - A filter expression consists in nested AND, OR and NOT expressions - involving boolean relation (>, >=, =, !=, <, <=) between event fields and - specific values. It is compiled into an efficient data structure which - is used in functions to check if a given event or tracefile satisfies the - filter. - - The grammar for filters is: - - filter = expression - - expression = "(" expression ")" | "!" expression | - expression "&&" expression | expression "||" expression | - simpleExpression - - simpleExpression = fieldPath op value - - fieldPath = fieldComponent [ "." fieldPath ] - - fieldComponent = name [ "[" integer "]" ] - - value = integer | double | string -*/ - /* structures prototypes */ typedef enum _LttvStructType LttvStructType; typedef enum _LttvFieldType LttvFieldType; @@ -67,7 +69,7 @@ typedef struct _LttvFilter LttvFilter; /** - * @enum LttvStructType + * @enum _LttvStructType * @brief The lttv structures * * the LttvStructType enumerates @@ -75,15 +77,15 @@ typedef struct _LttvFilter LttvFilter; * lttv core filter */ enum _LttvStructType { - LTTV_FILTER_TRACE, - LTTV_FILTER_TRACESET, - LTTV_FILTER_TRACEFILE, - LTTV_FILTER_EVENT, - LTTV_FILTER_STATE + LTTV_FILTER_TRACE, /**< trace (LttTrace) */ + LTTV_FILTER_TRACESET, /**< traceset */ + LTTV_FILTER_TRACEFILE, /**< tracefile (LttTracefile) */ + LTTV_FILTER_EVENT, /**< event (LttEvent) */ + LTTV_FILTER_STATE /**< state (LttvProcessState) */ }; /** - * @enum LttvFieldType + * @enum _LttvFieldType * @brief Possible fields for the structures * * the LttvFieldType enum consists on @@ -92,27 +94,27 @@ enum _LttvStructType { * filters can be applied. */ enum _LttvFieldType { - LTTV_FILTER_TRACE_NAME, /** trace.name (char*) */ - LTTV_FILTER_TRACEFILE_NAME, /** tracefile.name (char*) */ - LTTV_FILTER_STATE_PID, /** state.pid (guint) */ - LTTV_FILTER_STATE_PPID, /** state.ppid (guint) */ - LTTV_FILTER_STATE_CT, /** state.creation_time (double) */ - LTTV_FILTER_STATE_IT, /** state.insertion_time (double) */ - LTTV_FILTER_STATE_P_NAME, /** state.process_name (char*) */ - LTTV_FILTER_STATE_EX_MODE, /** state.execution_mode (LttvExecutionMode) */ - LTTV_FILTER_STATE_EX_SUBMODE, /** state.execution_submode (LttvExecutionSubmode) */ - LTTV_FILTER_STATE_P_STATUS, /** state.process_status (LttvProcessStatus) */ - LTTV_FILTER_STATE_CPU, /** state.cpu (?last_cpu?) */ - LTTV_FILTER_EVENT_NAME, /** event.name (char*) */ - LTTV_FILTER_EVENT_CATEGORY, /** FIXME: not implemented */ - LTTV_FILTER_EVENT_TIME, /** event.time (double) */ - LTTV_FILTER_EVENT_TSC, /** event.tsc (double) */ - LTTV_FILTER_EVENT_FIELD, - LTTV_FILTER_UNDEFINED /** undefined field */ + LTTV_FILTER_TRACE_NAME, /**< trace.name (char*) */ + LTTV_FILTER_TRACEFILE_NAME, /**< tracefile.name (char*) */ + LTTV_FILTER_STATE_PID, /**< state.pid (guint) */ + LTTV_FILTER_STATE_PPID, /**< state.ppid (guint) */ + LTTV_FILTER_STATE_CT, /**< state.creation_time (double) */ + LTTV_FILTER_STATE_IT, /**< state.insertion_time (double) */ + LTTV_FILTER_STATE_P_NAME, /**< state.process_name (char*) */ + LTTV_FILTER_STATE_EX_MODE, /**< state.execution_mode (LttvExecutionMode) */ + LTTV_FILTER_STATE_EX_SUBMODE, /**< state.execution_submode (LttvExecutionSubmode) */ + LTTV_FILTER_STATE_P_STATUS, /**< state.process_status (LttvProcessStatus) */ + LTTV_FILTER_STATE_CPU, /**< state.cpu (?last_cpu?) */ + LTTV_FILTER_EVENT_NAME, /**< event.name (char*) */ + LTTV_FILTER_EVENT_CATEGORY, /**< FIXME: not implemented */ + LTTV_FILTER_EVENT_TIME, /**< event.time (double) */ + LTTV_FILTER_EVENT_TSC, /**< event.tsc (double) */ + LTTV_FILTER_EVENT_FIELD, /**< dynamic field, specified in core.xml */ + LTTV_FILTER_UNDEFINED /**< undefined field */ }; /** - * @enum LttvExpressionOp + * @enum _LttvExpressionOp * @brief Contains possible operators * * This enumeration defines the @@ -122,18 +124,18 @@ enum _LttvFieldType { */ enum _LttvExpressionOp { - LTTV_FIELD_EQ, /** equal */ - LTTV_FIELD_NE, /** not equal */ - LTTV_FIELD_LT, /** lower than */ - LTTV_FIELD_LE, /** lower or equal */ - LTTV_FIELD_GT, /** greater than */ - LTTV_FIELD_GE /** greater or equal */ + LTTV_FIELD_EQ, /**< equal */ + LTTV_FIELD_NE, /**< not equal */ + LTTV_FIELD_LT, /**< lower than */ + LTTV_FIELD_LE, /**< lower or equal */ + LTTV_FIELD_GT, /**< greater than */ + LTTV_FIELD_GE /**< greater or equal */ }; /** - * @union LttvFieldValue - * + * @union _LttvFieldValue * @brief Contains possible field values + * * This particular union defines the * possible set of values taken by the * right member of a simple expression. @@ -141,30 +143,30 @@ enum _LttvExpressionOp * 'operators' functions */ union _LttvFieldValue { - guint64 v_uint64; - guint32 v_uint32; - guint16 v_uint16; - double v_double; - char* v_string; - LttTime v_ltttime; + guint64 v_uint64; /**< unsigned int of 64 bytes */ + guint32 v_uint32; /**< unsigned int of 32 bytes */ + guint16 v_uint16; /**< unsigned int of 16 bytes */ + double v_double; /**< double */ + char* v_string; /**< string */ + LttTime v_ltttime; /**< LttTime */ }; /** - * @enum LttvTreeElement + * @enum _LttvTreeElement * @brief element types for the tree nodes * * LttvTreeElement defines the possible * types of nodes which build the LttvFilterTree. */ enum _LttvTreeElement { - LTTV_TREE_IDLE, /** this node does nothing */ - LTTV_TREE_NODE, /** this node contains a logical operator */ - LTTV_TREE_LEAF /** this node is a leaf and contains a simple expression */ + LTTV_TREE_IDLE, /**< this node does nothing */ + LTTV_TREE_NODE, /**< this node contains a logical operator */ + LTTV_TREE_LEAF /**< this node is a leaf and contains a simple expression */ }; /** - * @struct LttvSimpleExpression + * @struct _LttvSimpleExpression * @brief simple expression structure * * An LttvSimpleExpression is the base @@ -177,15 +179,14 @@ enum _LttvTreeElement { */ struct _LttvSimpleExpression { - gint field; /** left member of simple expression */ - gint offset; /** offset used for dynamic fields */ - gboolean (*op)(gpointer,LttvFieldValue); /** operator of simple expression */ -// char *value; - LttvFieldValue value; /** right member of simple expression */ + gint field; /**< left member of simple expression */ + gint offset; /**< offset used for dynamic fields */ + gboolean (*op)(gpointer,LttvFieldValue); /**< operator of simple expression */ + LttvFieldValue value; /**< right member of simple expression */ }; /** - * @enum LttvLogicalOp + * @enum _LttvLogicalOp * @brief logical operators * * Contains the possible values taken @@ -194,41 +195,45 @@ struct _LttvSimpleExpression * AND, OR, XOR or NOT */ enum _LttvLogicalOp { - LTTV_LOGICAL_OR = 1, /** OR (1) */ - LTTV_LOGICAL_AND = 1<<1, /** AND (2) */ - LTTV_LOGICAL_NOT = 1<<2, /** NOT (4) */ - LTTV_LOGICAL_XOR = 1<<3 /** XOR (8) */ + LTTV_LOGICAL_OR = 1, /**< OR (1) */ + LTTV_LOGICAL_AND = 1<<1, /**< AND (2) */ + LTTV_LOGICAL_NOT = 1<<2, /**< NOT (4) */ + LTTV_LOGICAL_XOR = 1<<3 /**< XOR (8) */ }; /** - * @struct LttvFilterTree + * @struct _LttvFilterTree + * @brief The filtering tree + * * The filtering tree is used to represent the * expression string in its entire hierarchy * composed of simple expressions and logical * operators */ struct _LttvFilterTree { - int node; /** value of LttvLogicalOp */ - LttvTreeElement left; - LttvTreeElement right; + int node; /**< value of LttvLogicalOp */ + LttvTreeElement left; /**< nature of left branch (node/leaf) */ + LttvTreeElement right; /**< nature of right branch (node/leaf) */ union { - LttvFilterTree* t; - LttvSimpleExpression* leaf; - } l_child; + LttvFilterTree* t; + LttvSimpleExpression* leaf; + } l_child; /**< left branch of tree */ union { - LttvFilterTree* t; - LttvSimpleExpression* leaf; - } r_child; + LttvFilterTree* t; + LttvSimpleExpression* leaf; + } r_child; /**< right branch of tree */ }; /** - * @struct lttv_filter + * @struct _LttvFilter + * @brief The filter + * * Contains a binary tree of filtering options along * with the expression itself. */ struct _LttvFilter { - char *expression; - LttvFilterTree *head; + char *expression; /**< filtering expression string */ + LttvFilterTree *head; /**< tree associated to expression */ }; /* @@ -236,7 +241,7 @@ struct _LttvFilter { */ LttvSimpleExpression* lttv_simple_expression_new(); -gboolean lttv_simple_expression_add_field(GPtrArray* fp, LttvSimpleExpression* se); +gboolean lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se); gboolean lttv_simple_expression_assign_operator(LttvSimpleExpression* se, LttvExpressionOp op); diff --git a/ltt/branches/poly/lttv/modules/gui/filter/filter.c b/ltt/branches/poly/lttv/modules/gui/filter/filter.c index f611eb00..a73f1466 100644 --- a/ltt/branches/poly/lttv/modules/gui/filter/filter.c +++ b/ltt/branches/poly/lttv/modules/gui/filter/filter.c @@ -31,19 +31,22 @@ #include "hGuiFilterInsert.xpm" -/* - * TODO - * - connect the gui filter to the core filter - */ - -/* - * NOTE - * The version of gtk-2.0 currently installed on - * my desktop misses some function of the newer - * gtk+ api. +/*! \file lttv/modules/gui/filter/filter.c + * \brief Graphic filter interface. + * + * The gui filter facility gives the user an easy to use + * basic interface to construct and modify at will a filter + * expression. User may either decide to write it himself in + * expression text entry or add simple expressions using the + * many choices boxes. + * + * NOTE: + * The version of gtk-2.0 currently installed on + * my desktop misses some function of the newer + * gtk+ api. * - * For the time being, I'll use the older api - * to keep compatibility with most systems. + * For the time being, I'll use the older api + * to keep compatibility with most systems. */ typedef struct _FilterViewerData FilterViewerData; @@ -80,60 +83,62 @@ void callback_expression_field(GtkWidget *widget, gpointer data); * viewer data */ struct _FilterViewerDataLine { - int row; /** row number */ - gboolean visible; /** visible state */ - GtkWidget *f_not_op_box; /** '!' operator (GtkComboBox) */ - GtkWidget *f_logical_op_box; /** '&,|,^' operators (GtkComboBox) */ - GtkWidget *f_field_box; /** field types (GtkComboBox) */ - GtkWidget *f_math_op_box; /** '>,>=,<,<=,=,!=' operators (GtkComboBox) */ - GtkWidget *f_value_field; /** expression's value (GtkComboBox) */ + int row; /**< row number */ + gboolean visible; /**< visible state */ + GtkWidget *f_not_op_box; /**< '!' operator (GtkComboBox) */ + GtkWidget *f_logical_op_box; /**< '&,|,^' operators (GtkComboBox) */ + GtkWidget *f_field_box; /**< field types (GtkComboBox) */ + GtkWidget *f_math_op_box; /**< '>,>=,<,<=,=,!=' operators (GtkComboBox) */ + GtkWidget *f_value_field; /**< expression's value (GtkComboBox) */ }; /** - * @struct _FilterViewerData - * Main struct for the filter gui module + * @struct _FilterViewerData + * + * @brief Main structure of gui filter + * Main struct for the filter gui module */ struct _FilterViewerData { - Tab *tab; + Tab *tab; /**< current tab of module */ - GtkWidget *f_main_box; /** main container */ + GtkWidget *f_main_box; /**< main container */ - GtkWidget *f_expression_field; /** entire expression (GtkEntry) */ - GtkWidget *f_process_button; /** process expression button (GtkButton) */ + GtkWidget *f_expression_field; /**< entire expression (GtkEntry) */ + GtkWidget *f_process_button; /**< process expression button (GtkButton) */ - GtkWidget *f_logical_op_junction_box; /** linking operator box (GtkComboBox) */ + GtkWidget *f_logical_op_junction_box; /**< linking operator box (GtkComboBox) */ - int rows; /** number of rows */ - GPtrArray *f_lines; /** array of FilterViewerDataLine */ + int rows; /**< number of rows */ + GPtrArray *f_lines; /**< array of FilterViewerDataLine */ - GPtrArray *f_not_op_options; /** array of operators types for not_op box */ - GPtrArray *f_logical_op_options; /** array of operators types for logical_op box */ - GPtrArray *f_field_options; /** array of field types for field box */ - GPtrArray *f_math_op_options; /** array of operators types for math_op box */ + GPtrArray *f_not_op_options; /**< array of operators types for not_op box */ + GPtrArray *f_logical_op_options; /**< array of operators types for logical_op box */ + GPtrArray *f_field_options; /**< array of field types for field box */ + GPtrArray *f_math_op_options; /**< array of operators types for math_op box */ - GtkWidget *f_add_button; /** add expression to current expression (GtkButton) */ + GtkWidget *f_add_button; /**< add expression to current expression (GtkButton) */ }; /** - * @fn guifilter_get_widget(FilterViewerData*) + * @fn GtkWidget* guifilter_get_widget(FilterViewerData*) * * This function returns the current main widget * used by this module * @param fvd the module struct * @return The main widget */ -GtkWidget -*guifilter_get_widget(FilterViewerData *fvd) +GtkWidget* +guifilter_get_widget(FilterViewerData *fvd) { return fvd->f_main_box; } /** - * @fn gui_filter(Tab*) + * @fn FilterViewerData* gui_filter(Tab*) * * Constructor is used to create FilterViewerData data structure. - * @param the tab structure used by the widget + * @param tab The tab structure used by the widget * @return The Filter viewer data created. */ FilterViewerData* @@ -277,7 +282,7 @@ gui_filter(Tab *tab) } /** - * @fn gui_filter_add_line(FilterViewerData*) + * @fn FilterViewerDataLine* gui_filter_add_line(FilterViewerData*) * * Adds a filter option line on the module tab * @param fvd The filter module structure @@ -339,13 +344,14 @@ gui_filter_add_line(FilterViewerData* fvd) { } /** - * @fn gui_filter_line_set_visible(FilterViewerDataLine*,gboolean) + * @fn void gui_filter_line_set_visible(FilterViewerDataLine*,gboolean) * * Change visible state of current FilterViewerDataLine * @param fvdl pointer to the current FilterViewerDataLine * @param v TRUE: sets visible, FALSE: sets invisible */ -void gui_filter_line_set_visible(FilterViewerDataLine *fvdl, gboolean v) { +void +gui_filter_line_set_visible(FilterViewerDataLine *fvdl, gboolean v) { fvdl->visible = v; if(v) { @@ -365,13 +371,14 @@ void gui_filter_line_set_visible(FilterViewerDataLine *fvdl, gboolean v) { } /** - * @fn gui_filter_line_reset(FilterViewerDataLine*) + * @fn void gui_filter_line_reset(FilterViewerDataLine*) * * Sets selections of all boxes in current FilterViewerDataLine * to default value (0) * @param fvdl pointer to current FilterViewerDataLine */ -void gui_filter_line_reset(FilterViewerDataLine *fvdl) { +void +gui_filter_line_reset(FilterViewerDataLine *fvdl) { gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl->f_not_op_box),0); gtk_combo_box_set_active(GTK_COMBO_BOX(fvdl->f_field_box),0); @@ -381,7 +388,7 @@ void gui_filter_line_reset(FilterViewerDataLine *fvdl) { } /** - * @fn gui_filter_destructor(FilterViewerData*) + * @fn void gui_filter_destructor(FilterViewerData*) * * Destructor for the filter gui module * @param fvd The module structure @@ -406,7 +413,7 @@ gui_filter_destructor(FilterViewerData *fvd) } /** - * @fn filter_traceset_changed(void*,void*) + * @fn gboolean filter_traceset_changed(void*,void*) * * Hook function * @param hook_data The hook data @@ -420,7 +427,7 @@ filter_traceset_changed(void * hook_data, void * call_data) { } /** - * @fn filter_viewer_data(void*,void*) + * @fn gboolean filter_viewer_data(void*,void*) * * Hook function * @param hook_data The hook data @@ -434,7 +441,7 @@ filter_viewer_data(void * hook_data, void * call_data) { } /** - * @fn h_guifilter(Tab*) + * @fn GtkWidget* h_guifilter(Tab*) * * Filter Module's constructor hook * @@ -456,7 +463,7 @@ h_guifilter(Tab *tab) } /** - * @fn init() + * @fn static void init() * * This function initializes the Filter Viewer functionnality through the * gtkTraceSet API. @@ -472,12 +479,13 @@ static void init() { } /** - * @fn filter_destroy_walk(gpointer,gpointer) + * @fn void filter_destroy_walk(gpointer,gpointer) * * Initiate the destruction of the current gui module * on the GTK Interface */ -void filter_destroy_walk(gpointer data, gpointer user_data) +void +filter_destroy_walk(gpointer data, gpointer user_data) { FilterViewerData *fvd = (FilterViewerData*)data; @@ -488,7 +496,7 @@ void filter_destroy_walk(gpointer data, gpointer user_data) } /** - * @fn destroy() + * @fn static void destroy() * @brief plugin's destroy function * * This function releases the memory reserved by the module and unregisters @@ -501,13 +509,14 @@ static void destroy() { } /** - * @fn callback_process_button(GtkWidget*,gpointer) + * @fn void callback_process_button(GtkWidget*,gpointer) * * The Process Button callback function * @param widget The Button widget passed to the callback function * @param data Data sent along with the callback function */ -void callback_process_button(GtkWidget *widget, gpointer data) { +void +callback_process_button(GtkWidget *widget, gpointer data) { FilterViewerData *fvd = (FilterViewerData*)data; @@ -519,13 +528,14 @@ void callback_process_button(GtkWidget *widget, gpointer data) { } /** - * @fn callback_expression_field(GtkWidget*,gpointer) + * @fn void callback_expression_field(GtkWidget*,gpointer) * * The Add Button callback function * @param widget The Button widget passed to the callback function * @param data Data sent along with the callback function */ -void callback_expression_field(GtkWidget *widget, gpointer data) { +void +callback_expression_field(GtkWidget *widget, gpointer data) { FilterViewerData *fvd = (FilterViewerData*)data; @@ -538,13 +548,14 @@ void callback_expression_field(GtkWidget *widget, gpointer data) { /** - * @fn callback_add_button(GtkWidget*,gpointer) + * @fn void callback_add_button(GtkWidget*,gpointer) * * The Add Button callback function * @param widget The Button widget passed to the callback function * @param data Data sent along with the callback function */ -void callback_add_button(GtkWidget *widget, gpointer data) { +void +callback_add_button(GtkWidget *widget, gpointer data) { g_print("filter::callback_add_button()\n"); @@ -593,13 +604,14 @@ void callback_add_button(GtkWidget *widget, gpointer data) { } /** - * @fn callback_logical_op_box(GtkWidget*,gpointer) + * @fn void callback_logical_op_box(GtkWidget*,gpointer) * * The logical op box callback function * @param widget The Button widget passed to the callback function * @param data Data sent along with the callback function */ -void callback_logical_op_box(GtkWidget *widget, gpointer data) { +void +callback_logical_op_box(GtkWidget *widget, gpointer data) { g_print("filter::callback_logical_op_box()\n"); diff --git a/ltt/branches/poly/lttv/modules/text/textFilter.c b/ltt/branches/poly/lttv/modules/text/textFilter.c index 00fed540..488635ca 100644 --- a/ltt/branches/poly/lttv/modules/text/textFilter.c +++ b/ltt/branches/poly/lttv/modules/text/textFilter.c @@ -16,9 +16,13 @@ * MA 02111-1307, USA. */ -/* - * The text filter facility will prompt for user filter option - * and transmit them to the lttv core +/*! \file lttv/modules/text/textFilter.c + * \brief Textual prompt for user filtering expression. + * + * The text filter facility will prompt for user filter option + * and transmit them to the lttv core. User can either specify + * a filtering string with the command line or/and specify a + * file containing filtering expressions. */ #include @@ -64,8 +68,6 @@ static LttvHooks */ void filter_analyze_file(void *hook_data) { -// g_print("textFilter::filter_analyze_file\n"); - LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); @@ -101,8 +103,6 @@ void filter_analyze_file(void *hook_data) { */ void filter_analyze_string(void *hook_data) { -// g_print("textFilter::filter_analyze_string\n"); - LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); @@ -127,8 +127,6 @@ void filter_analyze_string(void *hook_data) { */ static void init() { -// g_print("textFilter::init()\n"); /* debug */ - LttvAttributeValue value; LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); -- 2.34.1