Re: [Geany-devel] Script: Generate loadable tag files for Geany

2010-07-31 Thread Guenther Brunthaler
Hi Dominic,

On 2010-07-31 00:05, Dominic Hopf wrote:

 You can find this one also at [1], thanks. :)
 
 [1] http://www.geany.org/Download/Extras

Thanks also for putting it there!

 Just a generic hint for the usage of this mailing list: You should start
 new threads for new topics, also if you have another contribution.

Didn't I?!

If so, then sorry! Normally, I certainly do.

Cheers,

Guenther
___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] Script: Generate loadable tag files for Geany

2010-07-31 Thread Liviu Andronic
On Sat, 31 Jul 2010 19:58:05 +0200
Dominic Hopf dma...@googlemail.com wrote:
 Am Samstag, den 31.07.2010, 18:04 +0200 schrieb Guenther Brunthaler:
   Just a generic hint for the usage of this mailing list: You
   should start new threads for new topics, also if you have another
   contribution.
  
  Didn't I?!
 Seems so. At least it looks like that in my mail client. ;)
 But well, I had just had a discussion with Enrico on IRC these days
 about Evolution which may does weird things for me here.
 
Here, with Claws, the Lua Script thread is also part of the Ratings
thread. It's probably because you chose to reply to the first thread
and change the subject. But this  looks like doubtful behaviour from
mail clients: even if the headers are the same, since the subjects are
different they would better consider two separate threads. For this
thread (in Claws), Gmail displays three different conversations.

Regards
Liviu
___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] Script: Generate loadable tag files for Geany

2010-07-30 Thread Dominic Hopf
Am Donnerstag, den 29.07.2010, 17:27 +0200 schrieb Guenther Brunthaler:
 Hi Lex,
 
 On 2010-07-29 05:20, Lex Trotman wrote:
 
  I better warn you that it might take a while, the developers are a bit
  overloaded with real life at the moment.
 
 No problem, but thanks for the warning anyway.
 
 Well, here's just the next script: It solves the problem that geany -g
 can only create tag files for one language at a time, but there may be
 multiple source code languages present in a project.
 
 This script runs geany -g with the correct parameters to generate tag
 files for all supported languages for the source files encountered in
 the current directory tree.
You can find this one also at [1], thanks. :)

[1] http://www.geany.org/Download/Extras


Just a generic hint for the usage of this mailing list: You should start
new threads for new topics, also if you have another contribution.
Easiest way to do so is, to compose a new mail to geany-devel@uvena.de
instead of pressing reply. That's really important for keeping the
conversations on the mailing list clearly arranged. :)

Regards,
Dominic

-- 
Dominic Hopf dma...@googlemail.com

http://dominichopf.de/

Key Fingerprint:
A7DF C4FC 07AE 4DDC 5CA0 BD93 AAB0 6019 CA7D 868D


signature.asc
Description: This is a digitally signed message part
___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


[Geany-devel] Script: Generate loadable tag files for Geany

2010-07-29 Thread Guenther Brunthaler
Hi Lex,

On 2010-07-29 05:20, Lex Trotman wrote:

 I better warn you that it might take a while, the developers are a bit
 overloaded with real life at the moment.

No problem, but thanks for the warning anyway.

Well, here's just the next script: It solves the problem that geany -g
can only create tag files for one language at a time, but there may be
multiple source code languages present in a project.

This script runs geany -g with the correct parameters to generate tag
files for all supported languages for the source files encountered in
the current directory tree.

This script gets its information (which file extensions are supported
for which languages) from parsing the Geany configuration files as well
as reading the directory tree searching for matching source files. It
also sets up CFLAGS automatically to include all directories containing
#include files in sorted breadth-first order.

I have to add that I wrote this script by mistake - I did not know
what Geany's tag-files are actually used for.

What I expected them to be was something like ctags files; that is, they
would allow me to find a tag declaration everywhere in a project, and
not just in the currently opened files.

But it turned out that tag files are actually only used for keyboard
completion and ballon help. ;-)

Cheers,

Guenther
#! /usr/bin/env lua
-- Generate loadable tag files for Geany.
--
-- This script runs geany -g with the correct parameters to generate
-- tag files for all supported languages for the source files in the
-- current directory tree.
--
-- This script gets its information from parsing the Geany configuration
-- files as well as reading the directory tree searching for matching
-- source files. It also sets up CFLAGS automatically to include all
-- directories containing #include files in sorted breadth-first order.
--
-- (c) 2010 by Guenther Brunthaler.
--
-- This script is free software.
-- Distribution is permitted under the terms of the GPLv3.


local old_globals= {}; for k in pairs(_G) do old_globals[k]= true; end


local base= /usr/share/geany
local includes_xtns= h H hxx h++ hpp inl


-- langs[LANGSYM].name == LANGUAGE.
-- langs[LANGSYM].files[INDEX] == RELATIVE_FILENAME.
local langs= {}
local globs= {} -- globs[PATTERN][LANGSYM] == true.
local directs= {} -- directs[STRING][LANGSYM] == true.


local function add_config(filename)
   local section, s, lang, pats, mode, sym, tbl
   for line in io.lines(filename) do
  line= string.match(line, ^%s*(.-)%s*$)
  if line ~=  and not string.match(line, ^#) then
 s= string.match(line, ^%[([^%]]+)%]$)
 if s then
section= s
 elseif section == Extensions then
lang, pats= string.match(line, ^([^=]+)%s*=%s*(.-;)$)
if lang then
   sym= string.lower(lang)
   if not langs[sym] then langs[sym]= {files= {}, name= lang}; end
   for xpat in string.gmatch(pats, %s*([^;]-)%s*;) do
  s= string.match(xpat, ^%*([^*]*)$)
  if s then
 if s ==  then
mode= false
 else
xpat= s
mode= suffix
 end
  else
 s= string.match(xpat, ^([^*]+)%*$)
 if s then
xpat= s
mode= prefix
 else
mode=
   string.match(xpat, %*) and complex or whole
 end
  end
  if mode then
 if mode == whole then
tbl= directs
 else
tbl= globs
xpat= string.gsub(xpat, ([-[%]^(%).*+?$]), %%%1)
if mode == prefix then
   xpat= ^ .. xpat
elseif mode == suffix then
   xpat= xpat .. $
else
   assert(mode == complex)
   xpat= ^ .. string.gsub(xpat, %%%*, .*) .. $
end
 end
 if not tbl[xpat] then
tbl[xpat]= {}
 end
 tbl[xpat][sym]= true
  end
   end
else
   io.stderr:write(
  string.format('Could not parse line %s!\n', line)
   )
end
 end
  end
   end
end


add_config(base .. /filetype_extensions.conf)
--[[
   do
  local o
  for _, t in
 ipairs{{n= directs, t= directs}, {n= globs, t= globs}}
  do
 o= {}
 for k in pairs(t.t) do
table.insert(o, k)
 end
 table.sort(o)
 for _, k in ipairs(o) do
o= {}
for k in pairs(t.t[k]) do
   table.insert(o,