summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/pychrysa.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-12-22 23:24:32 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-12-22 23:24:32 (GMT)
commit90b8f66eb8ae62d951dfbd333fb338e38874c9fe (patch)
tree6cc978cc15121bdda4edf65b609d8099329d94cd /plugins/pychrysalide/pychrysa.c
parentdb0404d4e6836ae05eb344a6d7f087f0a299f2a9 (diff)
Updated the documentation for the entry of Python bindings.
Diffstat (limited to 'plugins/pychrysalide/pychrysa.c')
-rw-r--r--plugins/pychrysalide/pychrysa.c70
1 files changed, 48 insertions, 22 deletions
diff --git a/plugins/pychrysalide/pychrysa.c b/plugins/pychrysalide/pychrysa.c
index 9f0bc20..3bc331c 100644
--- a/plugins/pychrysalide/pychrysa.c
+++ b/plugins/pychrysalide/pychrysa.c
@@ -127,7 +127,20 @@ static void load_python_plugins(GPluginModule *);
static PyObject *py_chrysalide_revision(PyObject *self, PyObject *args)
{
- return PyUnicode_FromString("r" XSTR(REVISION));
+ PyObject *result; /* Valeur à retourner */
+
+#define PY_CHRYSALIDE_REVISION_METHOD PYTHON_METHOD_DEF \
+( \
+ revision, "/", \
+ METH_NOARGS, py_chrysalide, \
+ "Provide the revision number of Chrysalide.\n" \
+ "\n" \
+ "The returned value is provided as a string, for instance: 'r1665'." \
+)
+
+ result = PyUnicode_FromString("r" XSTR(REVISION));
+
+ return result;
}
@@ -147,10 +160,20 @@ static PyObject *py_chrysalide_revision(PyObject *self, PyObject *args)
static PyObject *py_chrysalide_version(PyObject *self, PyObject *args)
{
- char version[16];
- int major;
- int minor;
- int revision;
+ PyObject *result; /* Valeur à retourner */
+ int major; /* Numéro de version majeur */
+ int minor; /* Numéro de version mineur */
+ int revision; /* Numéro de révision */
+ char version[16]; /* Conservation temporaire */
+
+#define PY_CHRYSALIDE_VERSION_METHOD PYTHON_METHOD_DEF \
+( \
+ version, "/", \
+ METH_NOARGS, py_chrysalide, \
+ "Provide the version number of Chrysalide.\n" \
+ "\n" \
+ "The returned value is provided as a string, for instance: '1.6.65'." \
+)
major = REVISION / 1000;
minor = (REVISION - (major * 1000)) / 100;
@@ -158,7 +181,9 @@ static PyObject *py_chrysalide_version(PyObject *self, PyObject *args)
snprintf(version, sizeof(version), "%d.%d.%d", major, minor, revision);
- return PyUnicode_FromString(version);
+ result = PyUnicode_FromString(version);
+
+ return result;
}
@@ -178,11 +203,23 @@ static PyObject *py_chrysalide_version(PyObject *self, PyObject *args)
static PyObject *py_chrysalide_mod_version(PyObject *self, PyObject *args)
{
- char version[16];
+ PyObject *result; /* Valeur à retourner */
+ char version[16]; /* Conservation temporaire */
+
+#define PY_CHRYSALIDE_MOD_VERSION_METHOD PYTHON_METHOD_DEF \
+( \
+ mod_version, "/", \
+ METH_NOARGS, py_chrysalide, \
+ "Provide the version number of Chrysalide module for Python.\n" \
+ "\n" \
+ "The returned value is provided as a string, for instance: '0.1.0'." \
+)
snprintf(version, sizeof(version), "%s", _chrysalide_plugin.version);
- return PyUnicode_FromString(version);
+ result = PyUnicode_FromString(version);
+
+ return result;
}
@@ -410,21 +447,10 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
PluginStatusFlags self_flags; /* Fanions à mettre à jour */
static PyMethodDef py_chrysalide_methods[] = {
-
- { "revision", py_chrysalide_revision,
- METH_NOARGS,
- "revision(/)\n--\n\nProvide the revision number of Chrysalide."
- },
- { "version", py_chrysalide_version,
- METH_NOARGS,
- "version(/)\n--\n\nProvide the version number of Chrysalide."
- },
- { "mod_version", py_chrysalide_mod_version,
- METH_NOARGS,
- "mod_version(/)\n--\n\nProvide the version number of Chrysalide module for Python."
- },
+ PY_CHRYSALIDE_REVISION_METHOD,
+ PY_CHRYSALIDE_VERSION_METHOD,
+ PY_CHRYSALIDE_MOD_VERSION_METHOD,
{ NULL }
-
};
static PyModuleDef py_chrysalide_module = {