Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 13 Oct 2013 16:52:56 UTC
Commit: 3443e288fe608306606f6b6a846886a377e46aff
https://github.com/geany/geany/commit/3443e288fe608306606f6b6a846886a377e46…
Log Message:
-----------
Add flag to tm_tags_find() to indicate the tags array may not be sorted
tm_tags_find() relies on a sorted tags array to be passed in but in
tm_source_file_set_tag_arglist() we don't have a sorted array yet and
sorting it on demand seems more heavy than the alternative:
make tm_tags_find() search the array linear if the new flag is set.
This fixes a bug in the Python parser when assigning the argument list
of __init__() methods to their class' argument list which annoyed me
for years already.
Also add a test case for this.
Modified Paths:
--------------
tagmanager/src/tm_source_file.c
tagmanager/src/tm_tag.c
tagmanager/src/tm_tag.h
tagmanager/src/tm_workspace.c
tests/ctags/Makefile.am
tests/ctags/py_constructor_arglist.py
tests/ctags/py_constructor_arglist.py.tags
Modified: tagmanager/src/tm_source_file.c
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -244,7 +244,8 @@ void tm_source_file_set_tag_arglist(const char *tag_name, const char *arglist)
return;
}
- tags = tm_tags_find(current_source_file->work_object.tags_array, tag_name, FALSE, &count);
+ tags = tm_tags_find(current_source_file->work_object.tags_array, tag_name, FALSE, FALSE,
+ &count);
if (tags != NULL && count == 1)
{
tag = tags[0];
Modified: tagmanager/src/tm_tag.c
37 files changed, 30 insertions(+), 7 deletions(-)
===================================================================
@@ -878,14 +878,37 @@ void tm_tags_array_free(GPtrArray *tags_array, gboolean free_all)
}
}
-TMTag **tm_tags_find(const GPtrArray *sorted_tags_array, const char *name,
- gboolean partial, int * tagCount)
+static TMTag **tags_search(const GPtrArray *tags_array, TMTag *tag, gboolean partial,
+ gboolean tags_array_sorted)
+{
+ if (tags_array_sorted)
+ { /* fast binary search on sorted tags array */
+ return (TMTag **) bsearch(&tag, tags_array->pdata, tags_array->len
+ , sizeof(gpointer), tm_tag_compare);
+ }
+ else
+ { /* the slow way: linear search (to make it a bit faster, search reverse assuming
+ * that the tag to search was added recently) */
+ int i;
+ TMTag **t;
+ for (i = tags_array->len - 1; i >= 0; i--)
+ {
+ t = (TMTag **) &tags_array->pdata[i];
+ if (0 == tm_tag_compare(&tag, t))
+ return t;
+ }
+ }
+ return NULL;
+}
+
+TMTag **tm_tags_find(const GPtrArray *tags_array, const char *name,
+ gboolean partial, gboolean tags_array_sorted, int * tagCount)
{
static TMTag *tag = NULL;
TMTag **result;
int tagMatches=0;
- if ((!sorted_tags_array) || (!sorted_tags_array->len))
+ if ((!tags_array) || (!tags_array->len))
return NULL;
if (NULL == tag)
@@ -893,12 +916,12 @@ TMTag **tm_tags_find(const GPtrArray *sorted_tags_array, const char *name,
tag->name = (char *) name;
s_sort_attrs = NULL;
s_partial = partial;
- result = (TMTag **) bsearch(&tag, sorted_tags_array->pdata, sorted_tags_array->len
- , sizeof(gpointer), tm_tag_compare);
+
+ result = tags_search(tags_array, tag, partial, tags_array_sorted);
/* There can be matches on both sides of result */
if (result)
{
- TMTag **last = (TMTag **) &sorted_tags_array->pdata[sorted_tags_array->len - 1];
+ TMTag **last = (TMTag **) &tags_array->pdata[tags_array->len - 1];
TMTag **adv;
/* First look for any matches after result */
@@ -911,7 +934,7 @@ TMTag **tm_tags_find(const GPtrArray *sorted_tags_array, const char *name,
++tagMatches;
}
/* Now look for matches from result and below */
- for (; result >= (TMTag **) sorted_tags_array->pdata; -- result)
+ for (; result >= (TMTag **) tags_array->pdata; -- result)
{
if (0 != tm_tag_compare(&tag, (TMTag **) result))
break;
Modified: tagmanager/src/tm_tag.h
12 files changed, 8 insertions(+), 4 deletions(-)
===================================================================
@@ -305,14 +305,18 @@ gboolean tm_tags_merge(GPtrArray *tags_array, gsize orig_len,
gboolean tm_tags_custom_dedup(GPtrArray *tags_array, TMTagCompareFunc compare_func);
/*!
- Returns a pointer to the position of the first matching tag in a sorted tags array.
- \param sorted_tags_array Tag array sorted on name
+ Returns a pointer to the position of the first matching tag in a (sorted) tags array.
+ The passed array of tags should be already sorted by name for optimal performance. If
+ \c tags_array_sorted is set to FALSE, it may be unsorted but the lookup will be slower.
+ \param tags_array Tag array (may be sorted on name)
\param name Name of the tag to locate.
\param partial If TRUE, matches the first part of the name instead of doing exact match.
+ \param tags_array_sorted If TRUE, the passed \c tags_array is sorted by name so it can be
+ searched with binary search. Otherwise it is searched linear which is obviously slower.
\param tagCount Return location of the matched tags.
*/
-TMTag **tm_tags_find(const GPtrArray *sorted_tags_array, const char *name,
- gboolean partial, int * tagCount);
+TMTag **tm_tags_find(const GPtrArray *tags_array, const char *name,
+ gboolean partial, gboolean tags_array_sorted, int * tagCount);
/*!
Completely frees an array of tags.
Modified: tagmanager/src/tm_workspace.c
7 files changed, 4 insertions(+), 3 deletions(-)
===================================================================
@@ -594,8 +594,9 @@ const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *at
else
tags = g_ptr_array_new();
- matches[0] = tm_tags_find(theWorkspace->work_object.tags_array, name, partial, &tagCount[0]);
- matches[1] = tm_tags_find(theWorkspace->global_tags, name, partial, &tagCount[1]);
+ matches[0] = tm_tags_find(theWorkspace->work_object.tags_array, name, partial, TRUE,
+ &tagCount[0]);
+ matches[1] = tm_tags_find(theWorkspace->global_tags, name, partial, TRUE, &tagCount[1]);
/* file tags */
if (matches[0] && *matches[0])
@@ -690,7 +691,7 @@ static gboolean match_langs(gint lang, const TMTag *tag)
if ((!src) || (!dst) || (!name) || (!*name))
return 0;
- match = tm_tags_find (src, name, partial, &count);
+ match = tm_tags_find (src, name, partial, TRUE, &count);
if (count && match && *match)
{
for (tagIter = 0; tagIter < count; ++tagIter)
Modified: tests/ctags/Makefile.am
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -194,6 +194,7 @@ test_sources = \
property.cs \
prototype.h \
pure_elem.f95 \
+ py_constructor_arglist.py \
random.sql \
readlob.sql \
readlong.sql \
Modified: tests/ctags/py_constructor_arglist.py
28 files changed, 28 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,28 @@
+"""
+Test arglist parsing of a class' __init__ method:
+the __init__() method's argument list should be assigned to the class' argument list.
+
+This is somewhat special to Python and the Python parses uses tm_source_file_set_tag_arglist()
+to do this and tm_source_file_set_tag_arglist() uses tm_tags_find() which by default relies on
+a sorted tags array. However, when the parses uses tm_source_file_set_tag_arglist() the tags
+array is *not yet* sorted and so it might be the tag for the class SomeClass can't be found,
+hence this test.
+"""
+
+from bsddb import btopen
+import sys
+from django.contrib.auth.decorators import login_required, permission_required
+from django.http import HttpResponse, HttpResponseBadRequest
+from django.shortcuts import render_to_response
+from django.template.context import RequestContext
+from django.utils import simplejson
+from django.views.decorators.csrf import csrf_exempt
+from django.views.decorators.csrf import csrf_exempt2
+from django.views.decorators.http import require_POST
+from vnstat.api.error import InterfaceDataValidationError
+
+
+class SomeClass(object):
+
+ def __init__(self, filename, pathsep='', treegap=64):
+ pass
Modified: tests/ctags/py_constructor_arglist.py.tags
16 files changed, 16 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,16 @@
+# format=tagmanager
+HttpResponse�256�0
+HttpResponseBadRequest�256�0
+InterfaceDataValidationError�256�0
+RequestContext�256�0
+SomeClass�1�(self, filename, pathsep='', treegap=64)�0
+__init__�128�(self, filename, pathsep='', treegap=64)�SomeClass�0
+btopen�256�0
+csrf_exempt�256�0
+csrf_exempt2�256�0
+login_required�256�0
+permission_required�256�0
+render_to_response�256�0
+require_POST�256�0
+simplejson�256�0
+sys�256�0
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven(a)btinternet.com>
Committer: Nick Treleaven <nick.treleaven(a)btinternet.com>
Date: Sun, 13 Oct 2013 11:57:37 UTC
Commit: a408938e957939594f549bc2bf5867699ece973d
https://github.com/geany/geany/commit/a408938e957939594f549bc2bf5867699ece9…
Log Message:
-----------
Set group for Clojure filetype
Modified Paths:
--------------
data/filetype_extensions.conf
Modified: data/filetype_extensions.conf
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -69,7 +69,7 @@ None=*;
# Note: restarting is required after editing groups
[Groups]
-Programming=CUDA;Cython;Genie;Go;Rust;Scala;
+Programming=Clojure;CUDA;Cython;Genie;Go;Rust;Scala;
Script=Graphviz;
Markup=
Misc=
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven(a)btinternet.com>
Committer: Nick Treleaven <nick.treleaven(a)btinternet.com>
Date: Fri, 11 Oct 2013 15:47:04 UTC
Commit: b3b6d4efade37d608894ecd897d77975b32601b8
https://github.com/geany/geany/commit/b3b6d4efade37d608894ecd897d77975b3260…
Log Message:
-----------
Fix missing warning section
Modified Paths:
--------------
HACKING
Modified: HACKING
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -395,7 +395,7 @@ changes to the source code. Follow instructions in the manual:
http://geany.org/manual/geany.html#custom-filetypes. Don't forget to
update the ``[Groups]`` section in ``filetype_extensions.conf``.
-.. warning:
+.. warning::
You should use the newer `[build-menu]` section for default build
commands - the older `[build_settings]` may not work correctly for
custom filetypes.
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven(a)btinternet.com>
Committer: Nick Treleaven <nick.treleaven(a)btinternet.com>
Date: Fri, 11 Oct 2013 15:43:27 UTC
Commit: 15fb2f321ad400ca911c8b69a9b1a78b3baa3b51
https://github.com/geany/geany/commit/15fb2f321ad400ca911c8b69a9b1a78b3baa3…
Log Message:
-----------
Improve custom filetype formatting/links
Modified Paths:
--------------
doc/geany.txt
Modified: doc/geany.txt
18 files changed, 11 insertions(+), 7 deletions(-)
===================================================================
@@ -3952,13 +3952,14 @@ the '``*``' wildcard - e.g. ``filetypes.Bar.conf``.
Custom filetypes are not as powerful as built-in filetypes, but
support for the following has been implemented:
-* Recognizing and setting the filetype (after the user has manually edited
- ``filetype_extensions.conf``).
+* Recognizing and setting the filetype (after the user has manually updated
+ the `filetype extensions`_ file).
+* `Filetype group membership`_.
* Reading filetype settings in the ``[settings]`` section, including:
* Using an existing syntax highlighting lexer (`lexer_filetype`_ key).
- * Using an existing tag parser (``tag_parser`` key).
+ * Using an existing tag parser (`tag_parser`_ key).
* Build commands (``[build-menu]`` section).
-* Loading global tags files (sharing the ``tag_parser`` namespace).
+* Loading global tags files (sharing the ``tag_parser`` filetype's namespace).
See `Filetype configuration`_ for details on each setting.
@@ -4166,6 +4167,8 @@ context_action_cmd
*Example:* ``context_action_cmd=devhelp -s "%s"``
+.. _tag_parser:
+
tag_parser
The TagManager language name, e.g. "C". Usually the same as the
filetype name.
@@ -4576,8 +4579,9 @@ whitespace_chars
Filetype extensions
-------------------
-To change the default filetype extension used when saving a new file,
-see `Filetype definition files`_.
+.. note::
+ To change the default filetype extension used when saving a new file,
+ see `Filetype definition files`_.
You can override the list of file extensions that Geany uses to detect
filetypes using the user ``filetype_extensions.conf`` file. Use the
@@ -4597,7 +4601,7 @@ should look like::
Make=Makefile*;*.mk;Buildfile;
Filetype group membership
--------------------------
+^^^^^^^^^^^^^^^^^^^^^^^^^
Group membership is also stored in ``filetype_extensions.conf``. This
file is used to store information Geany needs at startup, whereas the
separate filetype definition files hold information only needed when
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven(a)btinternet.com>
Committer: Nick Treleaven <nick.treleaven(a)btinternet.com>
Date: Fri, 11 Oct 2013 15:43:24 UTC
Commit: 18d27364ac9c526527fc7e56ee7f2a4e6effdb4d
https://github.com/geany/geany/commit/18d27364ac9c526527fc7e56ee7f2a4e6effd…
Log Message:
-----------
Update notes for adding a custom filetype
Modified Paths:
--------------
HACKING
Modified: HACKING
22 files changed, 20 insertions(+), 2 deletions(-)
===================================================================
@@ -384,7 +384,23 @@ Adding a source file foo.[hc] in src/ or plugins/
Adding a filetype
-----------------
You can add a filetype without syntax highlighting or tag parsing, but
-check to see if those features have been written in other projects first.
+check to see if those features have been written in upstream projects
+first (scintilla or ctags).
+
+**Custom:**
+
+If you want to reuse an existing lexer and/or tag parser, making a
+custom filetype is probably easier - it doesn't require any
+changes to the source code. Follow instructions in the manual:
+http://geany.org/manual/geany.html#custom-filetypes. Don't forget to
+update the ``[Groups]`` section in ``filetype_extensions.conf``.
+
+.. warning:
+ You should use the newer `[build-menu]` section for default build
+ commands - the older `[build_settings]` may not work correctly for
+ custom filetypes.
+
+**Built-in:**
* Add GEANY_FILETYPES_FOO to filetypes.h.
* Initialize GEANY_FILETYPES_FOO in init_builtin_filetypes() of
@@ -392,6 +408,8 @@ check to see if those features have been written in other projects first.
translation whenever possible.
* Update data/filetype_extensions.conf.
+The remaining notes relate mostly to built-in filetypes.
+
filetypes.* configuration file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All languages need a data/filetypes.foo configuration file. See
@@ -402,7 +420,7 @@ Programming languages should have:
* [keywords] if the lexer supports it.
* [settings] mostly for comment settings.
-* [build_settings] for commands to run.
+* [build-menu] (or [build_settings]) for commands to run.
For languages with a Scintilla lexer, there should be a [styling] section,
to correspond to the styles used in highlighting_styles_FOO[] in
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Frank Lanitz <flanitz(a)bgc-jena.mpg.de>
Committer: Frank Lanitz <flanitz(a)bgc-jena.mpg.de>
Date: Fri, 11 Oct 2013 07:56:08 UTC
Commit: 40cd633d5fc6f0bea1fda6edd03ee41e7604ae43
https://github.com/geany/geany/commit/40cd633d5fc6f0bea1fda6edd03ee41e7604a…
Log Message:
-----------
Update of Slovenian translation by Jože Klepec
Modified Paths:
--------------
po/sl.po
Modified: po/sl.po
2981 files changed, 1532 insertions(+), 1449 deletions(-)
===================================================================
No diff available, check online
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).