summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/glibext/buffercache.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/glibext/buffercache.c')
-rw-r--r--plugins/pychrysalide/glibext/buffercache.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/plugins/pychrysalide/glibext/buffercache.c b/plugins/pychrysalide/glibext/buffercache.c
index 019d981..d3bee45 100644
--- a/plugins/pychrysalide/glibext/buffercache.c
+++ b/plugins/pychrysalide/glibext/buffercache.c
@@ -73,9 +73,15 @@ static PyObject *py_buffer_cache_extend_with(PyObject *, PyObject *);
/* Réduit le tampon à une quantité de lignes précise. */
static PyObject *py_buffer_cache_truncate(PyObject *, PyObject *);
+/* Ajoute une propriété particulière à une ligne. */
+static PyObject *py_buffer_cache_add_line_flag(PyObject *, PyObject *);
+
/* Détermine l'ensemble des propriétés attachées à une ligne. */
static PyObject *py_buffer_cache_get_line_flags(PyObject *, PyObject *);
+/* Retire une propriété particulière attachée à une ligne. */
+static PyObject *py_buffer_cache_remove_line_flag(PyObject *, PyObject *);
+
/* Retrouve une ligne au sein d'un tampon avec un indice. */
static PyObject *py_buffer_cache_find_line_by_index(PyObject *, PyObject *);
@@ -568,6 +574,56 @@ static PyObject *py_buffer_cache_truncate(PyObject *self, PyObject *args)
/******************************************************************************
* *
+* Paramètres : self = tampon de lignes à venir consulter. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Ajoute une propriété particulière à une ligne. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_buffer_cache_add_line_flag(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Trouvailles à retourner */
+ size_t index; /* Indice de la ligne visée */
+ BufferLineFlags flag; /* Drapeau à considérer */
+ int ret; /* Bilan de lecture des args. */
+ GBufferCache *cache; /* Tampon natif à consulter */
+
+#define BUFFER_CACHE_ADD_LINE_FLAG_METHOD PYTHON_METHOD_DEF \
+( \
+ add_line_flag, "$self, index, flag, /", \
+ METH_VARARGS, py_buffer_cache, \
+ "Add one optional flag to those assigned to a given buffer" \
+ " line. The line is located using the *index* argument.\n" \
+ "\n" \
+ "The *index* has to be a simple integer, and the *flag* a" \
+ " pychrysalide.glibext.BufferLine.BufferLineFlags value.\n" \
+ "\n" \
+ "An access lock has to be held for the cache; see the" \
+ " pychrysalide.glibext.BufferCache.lock() function." \
+)
+
+ ret = PyArg_ParseTuple(args, "nO&", &index, convert_to_buffer_line_flags, &flag);
+ if (!ret) return NULL;
+
+ cache = G_BUFFER_CACHE(pygobject_get(self));
+
+ g_buffer_cache_add_line_flag(cache, index, flag);
+
+ result = Py_None;
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : self = classe représentant un tampon de code. *
* args = arguments fournis à l'appel. *
* *
@@ -617,6 +673,56 @@ static PyObject *py_buffer_cache_get_line_flags(PyObject *self, PyObject *args)
/******************************************************************************
* *
+* Paramètres : self = tampon de lignes à venir consulter. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Retire une propriété particulière attachée à une ligne. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_buffer_cache_remove_line_flag(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Trouvailles à retourner */
+ size_t index; /* Indice de la ligne visée */
+ BufferLineFlags flag; /* Drapeau à considérer */
+ int ret; /* Bilan de lecture des args. */
+ GBufferCache *cache; /* Tampon natif à consulter */
+
+#define BUFFER_CACHE_REMOVE_LINE_FLAG_METHOD PYTHON_METHOD_DEF \
+( \
+ remove_line_flag, "$self, index, flag, /", \
+ METH_VARARGS, py_buffer_cache, \
+ "Remove one optional flag from those assigned to a given buffer" \
+ " line. The line is located using the *index* argument.\n" \
+ "\n" \
+ "The *index* has to be a simple integer, and the *flag* a" \
+ " pychrysalide.glibext.BufferLine.BufferLineFlags value.\n" \
+ "\n" \
+ "An access lock has to be held for the cache; see the" \
+ " pychrysalide.glibext.BufferCache.lock() function." \
+)
+
+ ret = PyArg_ParseTuple(args, "nO&", &index, convert_to_buffer_line_flags, &flag);
+ if (!ret) return NULL;
+
+ cache = G_BUFFER_CACHE(pygobject_get(self));
+
+ g_buffer_cache_remove_line_flag(cache, index, flag);
+
+ result = Py_None;
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : self = classe représentant un tampon de code. *
* args = arguments fournis à l'appel. *
* *
@@ -942,7 +1048,9 @@ PyTypeObject *get_python_buffer_cache_type(void)
BUFFER_CACHE_APPEND_METHOD,
BUFFER_CACHE_EXTEND_WITH_METHOD,
BUFFER_CACHE_TRUNCATE_METHOD,
+ BUFFER_CACHE_ADD_LINE_FLAG_METHOD,
BUFFER_CACHE_GET_LINE_FLAGS_METHOD,
+ BUFFER_CACHE_REMOVE_LINE_FLAG_METHOD,
BUFFER_CACHE_FIND_LINE_BY_INDEX_METHOD,
BUFFER_CACHE_LOOK_FOR_FLAG_METHOD,
{ NULL }