summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-10-18 21:24:25 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-10-18 21:24:25 (GMT)
commit39f8a5c2a48a209507dbc3fd407052999954a199 (patch)
tree1dc29f7ddab258242c397e4a29a41913b5b24f66 /plugins/pychrysalide/analysis
parentf340a5d363c55d77aca047b6dd85dfaaae02bb6d (diff)
Updated the code for the types built from expressions.
Diffstat (limited to 'plugins/pychrysalide/analysis')
-rw-r--r--plugins/pychrysalide/analysis/types/expr.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/types/expr.c b/plugins/pychrysalide/analysis/types/expr.c
index 0d68a60..02cb02f 100644
--- a/plugins/pychrysalide/analysis/types/expr.c
+++ b/plugins/pychrysalide/analysis/types/expr.c
@@ -67,10 +67,20 @@ static PyObject *py_expr_type_new(PyTypeObject *type, PyObject *args, PyObject *
int ret; /* Bilan de lecture des args. */
GDataType *dtype; /* Version GLib du type */
+#define EXPR_TYPE_DOC \
+ "The ExprType class handles raw expressions defined for some types.\n" \
+ "\n" \
+ "Instances can be created using the following constructor:\n" \
+ "\n" \
+ " ExprType(value)" \
+ "\n" \
+ "The *value* expression can be any string value, which is not further" \
+ " processed."
+
ret = PyArg_ParseTuple(args, "s", &value);
if (!ret) return NULL;
- dtype = g_expr_type_new(strdup(value));
+ dtype = g_expr_type_new(value);
result = pygobject_new(G_OBJECT(dtype));
g_object_unref(dtype);
@@ -98,6 +108,14 @@ static PyObject *py_expr_type_get_value(PyObject *self, void *closure)
GExprType *type; /* Version GLib du type */
const char *value; /* Valeur exprimée */
+#define EXPR_TYPE_VALUE_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ value, py_expr_type, \
+ "Value of the expression type.\n" \
+ "\n" \
+ "This value can be any string." \
+)
+
type = G_EXPR_TYPE(pygobject_get(self));
value = g_expr_type_get_value(type);
@@ -128,10 +146,7 @@ PyTypeObject *get_python_expr_type_type(void)
};
static PyGetSetDef py_expr_type_getseters[] = {
- {
- "value", py_expr_type_get_value, NULL,
- "Provide the value of the expression type.", NULL
- },
+ EXPR_TYPE_VALUE_ATTRIB,
{ NULL }
};
@@ -144,7 +159,7 @@ PyTypeObject *get_python_expr_type_type(void)
.tp_flags = Py_TPFLAGS_DEFAULT,
- .tp_doc = "PyChrysalide expr type",
+ .tp_doc = EXPR_TYPE_DOC,
.tp_methods = py_expr_type_methods,
.tp_getset = py_expr_type_getseters,