summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/scan
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-10-06 11:41:46 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-10-06 11:41:46 (GMT)
commitedb4cc9c11c417d81b1948d93dfd171f0696217a (patch)
treef4d4d121f6a7428c06cf9e6610113a9d3755a461 /plugins/pychrysalide/analysis/scan
parent2553a987f2d8ba35d839152a35392ca29b409841 (diff)
Rename the registered items for ROST to make their name more expressive.
Diffstat (limited to 'plugins/pychrysalide/analysis/scan')
-rw-r--r--plugins/pychrysalide/analysis/scan/item.c140
-rw-r--r--plugins/pychrysalide/analysis/scan/item.h8
-rw-r--r--plugins/pychrysalide/analysis/scan/module.c2
-rw-r--r--plugins/pychrysalide/analysis/scan/space.c4
4 files changed, 77 insertions, 77 deletions
diff --git a/plugins/pychrysalide/analysis/scan/item.c b/plugins/pychrysalide/analysis/scan/item.c
index 3f46067..014ae24 100644
--- a/plugins/pychrysalide/analysis/scan/item.c
+++ b/plugins/pychrysalide/analysis/scan/item.c
@@ -42,24 +42,24 @@
/* Initialise la classe des éléments appelables enregistrés. */
-static void py_registered_item_init_gclass(GRegisteredItemClass *, gpointer);
+static void py_scan_registered_item_init_gclass(GScanRegisteredItemClass *, gpointer);
-CREATE_DYN_ABSTRACT_CONSTRUCTOR(registered_item, G_TYPE_REGISTERED_ITEM, py_registered_item_init_gclass);
+CREATE_DYN_ABSTRACT_CONSTRUCTOR(scan_registered_item, G_TYPE_SCAN_REGISTERED_ITEM, py_scan_registered_item_init_gclass);
/* Initialise une instance sur la base du dérivé de GObject. */
-static int py_registered_item_init(PyObject *, PyObject *, PyObject *);
+static int py_scan_registered_item_init(PyObject *, PyObject *, PyObject *);
/* Indique le nom associé à une expression d'évaluation. */
-static char *py_registered_item_get_name_wrapper(const GRegisteredItem *);
+static char *py_scan_registered_item_get_name_wrapper(const GScanRegisteredItem *);
/* Lance une résolution d'élément à solliciter. */
-static bool py_registered_item_resolve_wrapper(GRegisteredItem *, const char *, GScanContext *, GScanScope *, GRegisteredItem **);
+static bool py_scan_registered_item_resolve_wrapper(GScanRegisteredItem *, const char *, GScanContext *, GScanScope *, GScanRegisteredItem **);
/* Réduit une expression à une forme plus simple. */
-static bool py_registered_item_reduce_wrapper(GRegisteredItem *, GScanContext *, GScanScope *, GScanExpression **);
+static bool py_scan_registered_item_reduce_wrapper(GScanRegisteredItem *, GScanContext *, GScanScope *, GScanExpression **);
/* Effectue un appel à une fonction enregistrée. */
-static bool py_registered_item_run_call_wrapper(GRegisteredItem *, GScanExpression **, size_t, GScanContext *, GScanScope *, GObject **);
+static bool py_scan_registered_item_run_call_wrapper(GScanRegisteredItem *, GScanExpression **, size_t, GScanContext *, GScanScope *, GObject **);
@@ -67,10 +67,10 @@ static bool py_registered_item_run_call_wrapper(GRegisteredItem *, GScanExpressi
/* Lance une résolution d'élément à appeler. */
-static PyObject *py_registered_item_resolve(PyObject *, PyObject *);
+static PyObject *py_scan_registered_item_resolve(PyObject *, PyObject *);
/* Fournit le désignation associée à un composant nommé. */
-static PyObject *py_registered_item_get_name(PyObject *, void *);
+static PyObject *py_scan_registered_item_get_name(PyObject *, void *);
@@ -92,12 +92,12 @@ static PyObject *py_registered_item_get_name(PyObject *, void *);
* *
******************************************************************************/
-static void py_registered_item_init_gclass(GRegisteredItemClass *class, gpointer unused)
+static void py_scan_registered_item_init_gclass(GScanRegisteredItemClass *class, gpointer unused)
{
- class->get_name = py_registered_item_get_name_wrapper;
- class->resolve = py_registered_item_resolve_wrapper;
- class->reduce = py_registered_item_reduce_wrapper;
- class->run_call = py_registered_item_run_call_wrapper;
+ class->get_name = py_scan_registered_item_get_name_wrapper;
+ class->resolve = py_scan_registered_item_resolve_wrapper;
+ class->reduce = py_scan_registered_item_reduce_wrapper;
+ class->run_call = py_scan_registered_item_run_call_wrapper;
}
@@ -116,11 +116,11 @@ static void py_registered_item_init_gclass(GRegisteredItemClass *class, gpointer
* *
******************************************************************************/
-static int py_registered_item_init(PyObject *self, PyObject *args, PyObject *kwds)
+static int py_scan_registered_item_init(PyObject *self, PyObject *args, PyObject *kwds)
{
int ret; /* Bilan de lecture des args. */
-#define REGISTERED_ITEM_DOC \
+#define SCAN_REGISTERED_ITEM_DOC \
"The *RegisteredItem* class is an abstract definition which is" \
" the base for all keywords involved in a match condition" \
" expression.\n" \
@@ -159,7 +159,7 @@ static int py_registered_item_init(PyObject *self, PyObject *args, PyObject *kwd
* *
******************************************************************************/
-static char *py_registered_item_get_name_wrapper(const GRegisteredItem *item)
+static char *py_scan_registered_item_get_name_wrapper(const GScanRegisteredItem *item)
{
char *result; /* Désignation à retourner */
PyGILState_STATE gstate; /* Sauvegarde d'environnement */
@@ -167,12 +167,12 @@ static char *py_registered_item_get_name_wrapper(const GRegisteredItem *item)
PyObject *pyname; /* Nom en objet Python */
int ret; /* Bilan d'une conversion */
-#define REGISTERED_ITEM_NAME_ATTRIB_WRAPPER PYTHON_GETTER_WRAPPER_DEF \
-( \
- _name, \
- "Provide the keyword of the expression item to be evaluated.\n" \
- "\n" \
- "The result has to be a string." \
+#define SCAN_REGISTERED_ITEM_NAME_ATTRIB_WRAPPER PYTHON_GETTER_WRAPPER_DEF \
+( \
+ _name, \
+ "Provide the keyword of the expression item to be evaluated.\n" \
+ "\n" \
+ "The result has to be a string." \
)
result = NULL;
@@ -223,7 +223,7 @@ static char *py_registered_item_get_name_wrapper(const GRegisteredItem *item)
* *
******************************************************************************/
-static bool py_registered_item_resolve_wrapper(GRegisteredItem *item, const char *target, GScanContext *ctx, GScanScope *scope, GRegisteredItem **out)
+static bool py_scan_registered_item_resolve_wrapper(GScanRegisteredItem *item, const char *target, GScanContext *ctx, GScanScope *scope, GScanRegisteredItem **out)
{
bool result; /* Bilan à retourner */
PyGILState_STATE gstate; /* Sauvegarde d'environnement */
@@ -232,7 +232,7 @@ static bool py_registered_item_resolve_wrapper(GRegisteredItem *item, const char
PyObject *pyret; /* Bilan de consultation */
GObject *gobj_ret; /* Bilan natif de consultation */
-#define REGISTERED_ITEM_RESOLVE_WRAPPER PYTHON_WRAPPER_DEF \
+#define SCAN_REGISTERED_ITEM_RESOLVE_WRAPPER PYTHON_WRAPPER_DEF \
( \
_cmp_rich, "$self, target, ctx, scope, /", \
METH_VARARGS, \
@@ -267,9 +267,9 @@ static bool py_registered_item_resolve_wrapper(GRegisteredItem *item, const char
{
gobj_ret = pygobject_get(pyret);
- if (G_IS_REGISTERED_ITEM(gobj_ret))
+ if (G_IS_SCAN_REGISTERED_ITEM(gobj_ret))
{
- *out = G_REGISTERED_ITEM(gobj_ret);
+ *out = G_SCAN_REGISTERED_ITEM(gobj_ret);
g_object_ref(G_OBJECT(*out));
result = true;
@@ -308,7 +308,7 @@ static bool py_registered_item_resolve_wrapper(GRegisteredItem *item, const char
* *
******************************************************************************/
-static bool py_registered_item_reduce_wrapper(GRegisteredItem *item, GScanContext *ctx, GScanScope *scope, GScanExpression **out)
+static bool py_scan_registered_item_reduce_wrapper(GScanRegisteredItem *item, GScanContext *ctx, GScanScope *scope, GScanExpression **out)
{
bool result; /* Bilan à retourner */
PyGILState_STATE gstate; /* Sauvegarde d'environnement */
@@ -317,7 +317,7 @@ static bool py_registered_item_reduce_wrapper(GRegisteredItem *item, GScanContex
PyObject *pyret; /* Bilan de consultation */
GObject *gobj_ret; /* Bilan natif de consultation */
-#define REGISTERED_ITEM_REDUCE_WRAPPER PYTHON_WRAPPER_DEF \
+#define SCAN_REGISTERED_ITEM_REDUCE_WRAPPER PYTHON_WRAPPER_DEF \
( \
_cmp_rich, "$self, ctx, scope, /", \
METH_VARARGS, \
@@ -394,7 +394,7 @@ static bool py_registered_item_reduce_wrapper(GRegisteredItem *item, GScanContex
* *
******************************************************************************/
-static bool py_registered_item_run_call_wrapper(GRegisteredItem *item, GScanExpression **args, size_t count, GScanContext *ctx, GScanScope *scope, GObject **out)
+static bool py_scan_registered_item_run_call_wrapper(GScanRegisteredItem *item, GScanExpression **args, size_t count, GScanContext *ctx, GScanScope *scope, GObject **out)
{
bool result; /* Bilan à retourner */
PyGILState_STATE gstate; /* Sauvegarde d'environnement */
@@ -405,9 +405,9 @@ static bool py_registered_item_run_call_wrapper(GRegisteredItem *item, GScanExpr
PyObject *pyret; /* Bilan de consultation */
GObject *gobj_ret; /* Bilan natif de consultation */
-#define REGISTERED_ITEM_CALL_WRAPPER PYTHON_WRAPPER_DEF \
+#define SCAN_REGISTERED_ITEM_CALL_WRAPPER PYTHON_WRAPPER_DEF \
( \
- _cmp_rich, "$self, args, ctx, scope, /", \
+ _cmp_rich, "$self, args, ctx, scope, /", \
METH_VARARGS, \
"Abstract method used to replace the item and its arguments by an" \
" equivalent reduced value.\n" \
@@ -494,21 +494,21 @@ static bool py_registered_item_run_call_wrapper(GRegisteredItem *item, GScanExpr
* *
******************************************************************************/
-static PyObject *py_registered_item_resolve(PyObject *self, PyObject *args)
+static PyObject *py_scan_registered_item_resolve(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
const char *target; /* Désignation de la cible */
GScanContext *ctx; /* Contexte d'analyse */
GScanScope *scope; /* Portée de variables locales */
int ret; /* Bilan de lecture des args. */
- GRegisteredItem *item; /* Version native */
+ GScanRegisteredItem *item; /* Version native */
bool status; /* Bilan d'exécution */
- GRegisteredItem *resolved; /* Elément trouvé */
+ GScanRegisteredItem *resolved; /* Elément trouvé */
-#define REGISTERED_ITEM_RESOLVE_METHOD PYTHON_METHOD_DEF \
+#define SCAN_REGISTERED_ITEM_RESOLVE_METHOD PYTHON_METHOD_DEF \
( \
resolve, "$self, target, /, ctx=None, scope=None", \
- METH_VARARGS, py_registered_item, \
+ METH_VARARGS, py_scan_registered_item, \
"Resolve a name into a scan item." \
"\n" \
"The *target* name is the only mandatory parameter and has to point"\
@@ -532,9 +532,9 @@ static PyObject *py_registered_item_resolve(PyObject *self, PyObject *args)
convert_to_scan_context, &ctx);
if (!ret) return NULL;
- item = G_REGISTERED_ITEM(pygobject_get(self));
+ item = G_SCAN_REGISTERED_ITEM(pygobject_get(self));
- status = g_registered_item_resolve(item, target, ctx, scope, &resolved);
+ status = g_scan_registered_item_resolve(item, target, ctx, scope, &resolved);
if (!status)
{
@@ -573,23 +573,23 @@ static PyObject *py_registered_item_resolve(PyObject *self, PyObject *args)
* *
******************************************************************************/
-static PyObject *py_registered_item_get_name(PyObject *self, void *closure)
+static PyObject *py_scan_registered_item_get_name(PyObject *self, void *closure)
{
PyObject *result; /* Décompte à retourner */
- GRegisteredItem *item; /* Version native */
+ GScanRegisteredItem *item; /* Version native */
char *name; /* Désignation à convertir */
-#define REGISTERED_ITEM_NAME_ATTRIB PYTHON_GET_DEF_FULL \
+#define SCAN_REGISTERED_ITEM_NAME_ATTRIB PYTHON_GET_DEF_FULL \
( \
- name, py_registered_item, \
+ name, py_scan_registered_item, \
"Name linked to the registered item.\n" \
"\n" \
"The result should be a string, or *None* for the root namespace." \
)
- item = G_REGISTERED_ITEM(pygobject_get(self));
+ item = G_SCAN_REGISTERED_ITEM(pygobject_get(self));
- name = g_registered_item_get_name(item);
+ name = g_scan_registered_item_get_name(item);
if (name == NULL)
{
@@ -619,42 +619,42 @@ static PyObject *py_registered_item_get_name(PyObject *self, void *closure)
* *
******************************************************************************/
-PyTypeObject *get_python_registered_item_type(void)
+PyTypeObject *get_python_scan_registered_item_type(void)
{
- static PyMethodDef py_registered_item_methods[] = {
- REGISTERED_ITEM_RESOLVE_WRAPPER,
- REGISTERED_ITEM_REDUCE_WRAPPER,
- REGISTERED_ITEM_CALL_WRAPPER,
- REGISTERED_ITEM_RESOLVE_METHOD,
+ static PyMethodDef py_scan_registered_item_methods[] = {
+ SCAN_REGISTERED_ITEM_RESOLVE_WRAPPER,
+ SCAN_REGISTERED_ITEM_REDUCE_WRAPPER,
+ SCAN_REGISTERED_ITEM_CALL_WRAPPER,
+ SCAN_REGISTERED_ITEM_RESOLVE_METHOD,
{ NULL }
};
- static PyGetSetDef py_registered_item_getseters[] = {
- REGISTERED_ITEM_NAME_ATTRIB_WRAPPER,
- REGISTERED_ITEM_NAME_ATTRIB,
+ static PyGetSetDef py_scan_registered_item_getseters[] = {
+ SCAN_REGISTERED_ITEM_NAME_ATTRIB_WRAPPER,
+ SCAN_REGISTERED_ITEM_NAME_ATTRIB,
{ NULL }
};
- static PyTypeObject py_registered_item_type = {
+ static PyTypeObject py_scan_registered_item_type = {
PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = "pychrysalide.analysis.scan.RegisteredItem",
+ .tp_name = "pychrysalide.analysis.scan.ScanRegisteredItem",
.tp_basicsize = sizeof(PyGObject),
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_BASETYPE,
- .tp_doc = REGISTERED_ITEM_DOC,
+ .tp_doc = SCAN_REGISTERED_ITEM_DOC,
- .tp_methods = py_registered_item_methods,
- .tp_getset = py_registered_item_getseters,
+ .tp_methods = py_scan_registered_item_methods,
+ .tp_getset = py_scan_registered_item_getseters,
- .tp_init = py_registered_item_init,
- .tp_new = py_registered_item_new,
+ .tp_init = py_scan_registered_item_init,
+ .tp_new = py_scan_registered_item_new,
};
- return &py_registered_item_type;
+ return &py_scan_registered_item_type;
}
@@ -663,7 +663,7 @@ PyTypeObject *get_python_registered_item_type(void)
* *
* Paramètres : - *
* *
-* Description : Prend en charge l'objet 'pychrysalide...scan.RegisteredItem'.*
+* Description : Prend en charge l'objet 'pychrysalide...ScanRegisteredItem'. *
* *
* Retour : Bilan de l'opération. *
* *
@@ -671,13 +671,13 @@ PyTypeObject *get_python_registered_item_type(void)
* *
******************************************************************************/
-bool ensure_python_registered_item_is_registered(void)
+bool ensure_python_scan_registered_item_is_registered(void)
{
- PyTypeObject *type; /* Type Python 'RegisteredItem' */
+ PyTypeObject *type; /* Type 'ScanRegisteredItem' */
PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- type = get_python_registered_item_type();
+ type = get_python_scan_registered_item_type();
if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
{
@@ -685,7 +685,7 @@ bool ensure_python_registered_item_is_registered(void)
dict = PyModule_GetDict(module);
- if (!register_class_for_pygobject(dict, G_TYPE_REGISTERED_ITEM, type))
+ if (!register_class_for_pygobject(dict, G_TYPE_SCAN_REGISTERED_ITEM, type))
return false;
}
@@ -708,11 +708,11 @@ bool ensure_python_registered_item_is_registered(void)
* *
******************************************************************************/
-int convert_to_registered_item(PyObject *arg, void *dst)
+int convert_to_scan_registered_item(PyObject *arg, void *dst)
{
int result; /* Bilan à retourner */
- result = PyObject_IsInstance(arg, (PyObject *)get_python_registered_item_type());
+ result = PyObject_IsInstance(arg, (PyObject *)get_python_scan_registered_item_type());
switch (result)
{
@@ -726,7 +726,7 @@ int convert_to_registered_item(PyObject *arg, void *dst)
break;
case 1:
- *((GRegisteredItem **)dst) = G_REGISTERED_ITEM(pygobject_get(arg));
+ *((GScanRegisteredItem **)dst) = G_SCAN_REGISTERED_ITEM(pygobject_get(arg));
break;
default:
diff --git a/plugins/pychrysalide/analysis/scan/item.h b/plugins/pychrysalide/analysis/scan/item.h
index b3f1661..773908c 100644
--- a/plugins/pychrysalide/analysis/scan/item.h
+++ b/plugins/pychrysalide/analysis/scan/item.h
@@ -32,13 +32,13 @@
/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_registered_item_type(void);
+PyTypeObject *get_python_scan_registered_item_type(void);
-/* Prend en charge l'objet 'pychrysalide.analysis.scan.RegisteredItem'. */
-bool ensure_python_registered_item_is_registered(void);
+/* Prend en charge l'objet 'pychrysalide.analysis.scan.ScanRegisteredItem'. */
+bool ensure_python_scan_registered_item_is_registered(void);
/* Tente de convertir en expression d'évaluation généraliste. */
-int convert_to_registered_item(PyObject *, void *);
+int convert_to_scan_registered_item(PyObject *, void *);
diff --git a/plugins/pychrysalide/analysis/scan/module.c b/plugins/pychrysalide/analysis/scan/module.c
index 2c5b1ef..9ae0e52 100644
--- a/plugins/pychrysalide/analysis/scan/module.c
+++ b/plugins/pychrysalide/analysis/scan/module.c
@@ -109,7 +109,7 @@ bool populate_analysis_scan_module(void)
if (result) result = ensure_python_content_scanner_is_registered();
if (result) result = ensure_python_scan_context_is_registered();
if (result) result = ensure_python_scan_expression_is_registered();
- if (result) result = ensure_python_registered_item_is_registered();
+ if (result) result = ensure_python_scan_registered_item_is_registered();
if (result) result = ensure_python_scan_options_is_registered();
if (result) result = ensure_python_scan_namespace_is_registered();
diff --git a/plugins/pychrysalide/analysis/scan/space.c b/plugins/pychrysalide/analysis/scan/space.c
index 79e0c28..c901cd9 100644
--- a/plugins/pychrysalide/analysis/scan/space.c
+++ b/plugins/pychrysalide/analysis/scan/space.c
@@ -122,7 +122,7 @@ static int py_scan_namespace_init(PyObject *self, PyObject *args, PyObject *kwds
static PyObject *py_scan_namespace_register_item(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
- GRegisteredItem *item; /* Elément d'évaluation à lier */
+ GScanRegisteredItem *item; /* Elément d'évaluation à lier */
int ret; /* Bilan de lecture des args. */
GScanNamespace *space; /* Version native */
bool status; /* Bilan de l'opération */
@@ -140,7 +140,7 @@ static PyObject *py_scan_namespace_register_item(PyObject *self, PyObject *args)
" *True* in case of success, *False* for a failure.\n" \
)
- ret = PyArg_ParseTuple(args, "O&", convert_to_registered_item, &item);
+ ret = PyArg_ParseTuple(args, "O&", convert_to_scan_registered_item, &item);
if (!ret) return NULL;
space = G_SCAN_NAMESPACE(pygobject_get(self));