diff options
Diffstat (limited to 'src/analysis/scan/expr-int.h')
-rw-r--r-- | src/analysis/scan/expr-int.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/analysis/scan/expr-int.h b/src/analysis/scan/expr-int.h new file mode 100644 index 0000000..4323693 --- /dev/null +++ b/src/analysis/scan/expr-int.h @@ -0,0 +1,78 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * expr-int.h - prototypes internes pour la définition d'une expression servant aux conditions de correspondance + * + * Copyright (C) 2022 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _ANALYSIS_SCAN_EXPR_INT_H +#define _ANALYSIS_SCAN_EXPR_INT_H + + +#include "expr.h" + + +#include <stdbool.h> + + +#include "../../glibext/comparison-int.h" + + + +/* Réalise une comparaison entre objets selon un critère précis. */ +typedef bool (* compare_expr_rich_fc) (const GScanExpression *, const GScanExpression *, RichCmpOperation, bool *); + +/* Vérifie la validité d'une expression. */ +typedef bool (* check_expr_validity_fc) (const GScanExpression *); + +/* Reproduit une expression en place dans une nouvelle instance. */ +typedef GScanExpression * (* dup_expr_fc) (const GScanExpression *); + +/* Réduit une expression à une forme plus simple. */ +typedef GScanExpression * (* reduce_expr_fc) (GScanExpression *, GScanContext *, bool); + + +/* Expression d'évaluation généraliste (instance) */ +struct _GScanExpression +{ + GObject parent; /* A laisser en premier */ + + ExprValueType value_type; /* Type de valeur portée */ + +}; + +/* Expression d'évaluation généraliste (classe) */ +struct _GScanExpressionClass +{ + GObjectClass parent; /* A laisser en premier */ + + compare_expr_rich_fc cmp_rich; /* Comparaison de façon précise*/ + check_expr_validity_fc check; /* Validation de la cohérence */ + dup_expr_fc dup; /* Reproduction d'expression */ + reduce_expr_fc reduce; /* Simplification d'expression */ + +}; + + +/* Met en place une expression d'évaluation pour analyse. */ +bool g_scan_expression_create(GScanExpression *, ExprValueType); + + + +#endif /* _ANALYSIS_SCAN_EXPR_INT_H */ |