* 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 <lttv/filter.h>
-#include <ltt/time.h>
-
-/*
-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()
}
/**
- * @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
* 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) {
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
/**
- * @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
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
}
/**
- * @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
/**
- * @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
}
/**
- * @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
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);
/**
* @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() {
LttvFilter* filter = g_new(LttvFilter,1);
filter->expression = NULL;
filter->head = NULL;
+
+ return filter;
}
}
/**
- * @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
}
/**
- * @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
/**
- * @fn void lttv_print_tree(LttvFilterTree*)
- *
- * Debug
+ * Debug function. Prints tree memory allocation.
* @param t the pointer to the current LttvFilterTree
*/
void
}
/**
- * @fn Destroys the filter module and specific values
+ * Destroys the filter module and specific values
*/
static void module_destroy()
{
#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 <lttv/traceset.h>
#include <lttv/tracecontext.h>
#include <lttv/state.h>
#include <ltt/time.h>
#include <ltt/event.h>
-
-/*
- 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;
/**
- * @enum LttvStructType
+ * @enum _LttvStructType
* @brief The lttv structures
*
* the LttvStructType enumerates
* 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
* 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
*/
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.
* '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
*/
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
* 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 */
};
/*
*/
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);
#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;
* 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*
}
/**
- * @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
}
/**
- * @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) {
}
/**
- * @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);
}
/**
- * @fn gui_filter_destructor(FilterViewerData*)
+ * @fn void gui_filter_destructor(FilterViewerData*)
*
* Destructor for the filter gui module
* @param fvd The module structure
}
/**
- * @fn filter_traceset_changed(void*,void*)
+ * @fn gboolean filter_traceset_changed(void*,void*)
*
* Hook function
* @param hook_data The hook data
}
/**
- * @fn filter_viewer_data(void*,void*)
+ * @fn gboolean filter_viewer_data(void*,void*)
*
* Hook function
* @param hook_data The hook data
}
/**
- * @fn h_guifilter(Tab*)
+ * @fn GtkWidget* h_guifilter(Tab*)
*
* Filter Module's constructor hook
*
}
/**
- * @fn init()
+ * @fn static void init()
*
* This function initializes the Filter Viewer functionnality through the
* gtkTraceSet API.
}
/**
- * @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;
}
/**
- * @fn destroy()
+ * @fn static void destroy()
* @brief plugin's destroy function
*
* This function releases the memory reserved by the module and unregisters
}
/**
- * @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;
}
/**
- * @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;
/**
- * @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");
}
/**
- * @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");
* 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 <lttv/lttv.h>
*/
void filter_analyze_file(void *hook_data) {
-// g_print("textFilter::filter_analyze_file\n");
-
LttvAttributeValue value;
LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
*/
void filter_analyze_string(void *hook_data) {
-// g_print("textFilter::filter_analyze_string\n");
-
LttvAttributeValue value;
LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
*/
static void init() {
-// g_print("textFilter::init()\n"); /* debug */
-
LttvAttributeValue value;
LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());