[Geany-devel] C/C++ Header filetypes / templates

Lex Trotman elextr at xxxxx
Thu Nov 13 08:39:43 UTC 2008

Hi Guys,

Further thoughts on how to allow variations on the commands associated with
a filetype, I would propose having a concept of a variant of a filetype.
This is just extra information determined from a subset of the filetypes
extensions.  It can be implemented fully configurable from the filetypes.xxx
file so no hard coded magic.  An extract of the extended filetypes.c below
shows what I mean:

# list of the variants supported

# definition of how the variant is detected, list of extension patterns

# default build settings for no variants
compiler=gcc -Wall -c "%f"
linker=gcc -Wall -o "%e" "%f"

# buld settings for variant hdrs
compiler=gcc -Wall -c "%f"
# no linker or run for headers

This is backward compatible with existing filetypes .c because the default
[build_settings] is still there and the same.

The document has a pointer to the variant information so the build menu can
be set from it per file.

Attached is a patch against the build-system branch revision 3195 which was
before header filetypes changes.  It gives you an idea of the amount of code
needed to set the variant commands, not too much really and fairly
localised.  Obviously saving/restoring and using them is part of the
upcoming build system changes so the patch does nothing visible.

Other variants can be defined, which I suspect could be useful when some of
the upcoming incompatible language changes hit eg python 3 & perl 6 so that
commands can vary with dialect.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20081113/da183869/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: variant.patch
Type: text/x-patch
Size: 8513 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20081113/da183869/attachment.bin>

More information about the Devel mailing list