diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2023-08-18 00:07:39 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2023-08-18 00:07:39 (GMT) |
commit | 2424c52c4f3bc44ce5f36348442cfa103e0989c2 (patch) | |
tree | f68aea488f403b234d4fcc6fd6e0f7b88a628ac8 /plugins/pychrysalide/analysis/scan/context.c | |
parent | 1c5a0e67186def152536d9c506e2e6c3a3a265c5 (diff) |
Create some modifiers and handle match properties inside ROST.
Diffstat (limited to 'plugins/pychrysalide/analysis/scan/context.c')
-rw-r--r-- | plugins/pychrysalide/analysis/scan/context.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/scan/context.c b/plugins/pychrysalide/analysis/scan/context.c index 524ec46..8f29457 100644 --- a/plugins/pychrysalide/analysis/scan/context.c +++ b/plugins/pychrysalide/analysis/scan/context.c @@ -44,9 +44,15 @@ CREATE_DYN_CONSTRUCTOR(scan_context, G_TYPE_SCAN_CONTEXT); /* Initialise une instance sur la base du dérivé de GObject. */ static int py_scan_context_init(PyObject *, PyObject *, PyObject *); +/* Note que la phase d'analyse de contenu est terminée. */ +static PyObject *py_scan_context_mark_scan_as_done(PyObject *, PyObject *); + /* Indique si une correspondance globale a pu être établie. */ static PyObject *py_scan_context_has_match_for_rule(PyObject *, PyObject *); +/* Indique si la phase d'analyse de contenu est terminée. */ +static PyObject *py_scan_context_is_scan_done(PyObject *, void *); + /****************************************************************************** @@ -95,6 +101,43 @@ static int py_scan_context_init(PyObject *self, PyObject *args, PyObject *kwds) * Paramètres : self = classe représentant un format. * * args = arguments fournis à l'appel. * * * +* Description : Note que la phase d'analyse de contenu est terminée. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static PyObject *py_scan_context_mark_scan_as_done(PyObject *self, PyObject *args) +{ + PyObject *result; /* Contexte de suivi à renvoyer*/ + GScanContext *context; /* Contexte de suivi d'analyse */ + +#define SCAN_CONTEXT_MARK_SCAN_AS_DONE_METHOD PYTHON_METHOD_DEF \ +( \ + mark_scan_as_done, "$self", \ + METH_NOARGS, py_scan_context, \ + "Note that the analysis operations are finished." \ +) + + context = G_SCAN_CONTEXT(pygobject_get(self)); + + g_scan_context_mark_scan_as_done(context); + + result = Py_None; + Py_INCREF(result); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : self = classe représentant un format. * +* args = arguments fournis à l'appel. * +* * * Description : Indique si une correspondance globale a pu être établie. * * * * Retour : Bilan final d'une analyse (False par défaut). * @@ -140,6 +183,46 @@ static PyObject *py_scan_context_has_match_for_rule(PyObject *self, PyObject *ar /****************************************************************************** * * +* Paramètres : self = objet Python concerné par l'appel. * +* closure = non utilisé ici. * +* * +* Description : Indique si la phase d'analyse de contenu est terminée. * +* * +* Retour : True si la phase de scan est terminée, False sinon. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static PyObject *py_scan_context_is_scan_done(PyObject *self, void *closure) +{ + PyObject *result; /* Instance Python à retourner */ + GScanContext *context; /* Contexte de suivi d'analyse */ + bool status; /* Bilan de consultation */ + +#define SCAN_CONTEXT_IS_SCAN_DONE_ATTRIB PYTHON_IS_DEF_FULL \ +( \ + scan_done, py_scan_context, \ + "Tell if the analysis operations are finished.\n" \ + "\n" \ + "The result is a boolean: *True* if the scan is marked as" \ + " done, *False* otherwise." \ +) + + context = G_SCAN_CONTEXT(pygobject_get(self)); + + status = g_scan_context_is_scan_done(context); + + result = status ? Py_True : Py_False; + Py_INCREF(result); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : - * * * * Description : Fournit un accès à une définition de type à diffuser. * @@ -153,11 +236,13 @@ static PyObject *py_scan_context_has_match_for_rule(PyObject *self, PyObject *ar PyTypeObject *get_python_scan_context_type(void) { static PyMethodDef py_scan_context_methods[] = { + SCAN_CONTEXT_MARK_SCAN_AS_DONE_METHOD, SCAN_CONTEXT_HAS_MATCH_FOR_RULE_METHOD, { NULL } }; static PyGetSetDef py_scan_context_getseters[] = { + SCAN_CONTEXT_IS_SCAN_DONE_ATTRIB, { NULL } }; |