diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-05-10 20:21:56 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-05-10 20:21:56 (GMT) |
commit | 8e76324b01e5b4979f346f0bc8c84372477a3d38 (patch) | |
tree | 3db4057e113aa9f664f5b217dd349bb1e9288009 /plugins/pychrysa/helpers.c | |
parent | b0c6ffacf5c6c45c047172e348c737cb85fb5b36 (diff) |
Rewritten the whole bitfield management.
Diffstat (limited to 'plugins/pychrysa/helpers.c')
-rw-r--r-- | plugins/pychrysa/helpers.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/pychrysa/helpers.c b/plugins/pychrysa/helpers.c index 36d0d76..df1df05 100644 --- a/plugins/pychrysa/helpers.c +++ b/plugins/pychrysa/helpers.c @@ -31,6 +31,60 @@ /****************************************************************************** * * +* Paramètres : status = bilan de comparaison à traduire. * +* op = type de comparaison menée. * +* * +* Description : Traduit pour Python le bilan d'une comparaison riche. * +* * +* Retour : Objet Python à référencer. * +* * +* Remarques : - * +* * +******************************************************************************/ + +PyObject *status_to_rich_cmp_state(int status, int op) +{ + PyObject *result; /* Bilan àretourner */ + + switch (op) + { + case Py_LT: + result = status < 0 ? Py_True : Py_False; + break; + + case Py_LE: + result = status <= 0 ? Py_True : Py_False; + break; + + case Py_EQ: + result = status == 0 ? Py_True : Py_False; + break; + + case Py_NE: + result = status != 0 ? Py_True : Py_False; + break; + + case Py_GT: + result = status > 0 ? Py_True : Py_False; + break; + + case Py_GE: + result = status >= 0 ? Py_True : Py_False; + break; + + default: + result = Py_NotImplemented; + break; + + } + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : target = propriétaire de la routine visée. * * method = désignation de la fonction à appeler. * * * |