[Geany-devel] Geany Plugin with Libxml

Cédric Tabin tabin.cedric at xxxxx
Mon Aug 10 19:51:36 UTC 2009


Hello Chow,

Thanks for your feedback :-) I've fixed the issues you mentionned (I hope)
and upgraded a little bit my code. Since now I always used my small compile
script which is very simple :

#!/bin/sh

source="src/Plugin.c"
output="XMLPrettyPrinter"

gcc -std=c99 -o "$output.o" -Wall -c -fpic "$source" `pkg-config --cflags
geany libxml-2.0`
gcc -shared  -o "$output.so" "$output.o" `pkg-config --libs geany
libxml-2.0`

And so far there was no compile error. Can you explain me how to use the
automatic build so I won't commit unbuildable code ?
One more question : in my Plugin.c file, I #include the PrettyPrinter.c file
because at if I use PrettyPrinter.h, at runtime Geany said me that it was
unable to find the reference to my PrettyPrinter options... Maybe something
wrong in my compilation script ? That's a problem of linking isn't it ?

I you have any other comment, please let me know :-)

Best regards,
Cedric

On Mon, Aug 10, 2009 at 5:46 PM, Chow Loong Jin <hyperair at gmail.com> wrote:

> On Monday 10,August,2009 05:56 PM, Cédric Tabin wrote:
> > Hi Franck,
> >
> > I put my plugin where you said already =>
> >
> http://geany-plugins.svn.sourceforge.net/viewvc/geany-plugins/trunk/pretty-printer/
> > I'll wait for your commit of the build system, so I can try it on my
> > computer :-)
>
> Hi Cédric,
>
> I've just integrated your plugin into the Autotools build system.
> However, your plugin still does not compile. Here are the issues
> preventing it from compiling:
> 1. Declaration of variables inside a for loop
> In C++, we like this:
> for (int i = 0; ...
>
> In C, we don't. We do this:
> int i;
> for (i = 0; ...
>
> 2. Bad #include.
> We don't like to #include .c files. I suspect this is a typo, which
> causes multiple definitions of a function, resulting in problems
> linking. See line 27 of pretty-printer/src/Plugin.c: #include
> "PrettyPrinter.c".
>
> 3. Missing decls for TRUE and FALSE.
> TRUE and FALSE are defined in the header "glib/gmacros.h", found in
> /usr/include/glib-2.0 on Debian and its derivatives. I suspect you
> forgot to include this in PrettyPrinter.c
>
> A minor issue that should be fixed anyway:
> 1. Usage of the "boolean" type
> Rather than #define boolean int, how about using the gboolean datatype,
> found in the header "glib/gtypes.h", found in /usr/include/glib-2.0?
>
> Now for some cosmetic issues:
> 1. Long lines
> Long lines are a pain to read and destroy the entire purpose of
> indentation if they wrap. I believe the general consensus is 80
> characters per line. I'd suggest reducing your lines to fit that length,
> and chopping some lines up into smaller lines.
>
> Trivia: A dot matrix printer can only have 80 characters in a line
> before they get wrapped!
>
> 2. Copyright headers
> Your files have a license header, which is good. However, for GPL files,
> it is generally customary to have something like this:
>
>    Copyright (C) <year>  <name of author>
>
>    This program is free software; you can redistribute it and/or modify
>    it under the terms of the GNU General Public License as published by
>    the Free Software Foundation; either version 2 of the License, or
>    (at your option) any later version.
>
>    This program is distributed in the hope that it will be useful,
>    but WITHOUT ANY WARRANTY; without even the implied warranty of
>    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>    GNU General Public License for more details.
>
>    You should have received a copy of the GNU General Public License along
>    with this program; if not, write to the Free Software Foundation, Inc.,
>    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>
> This block is found near the end of the GPL license text. A copy can be
> found in /usr/share/common-licenses/GPL-2 on Debian and its derivatives.
>
>
>
> I would have fixed the compilation issues for you, but I figured that
> since you mentioned you'd like to hear suggestions so you can learn, it
> would be good for you to fix these yourself. :-)
>
> --
> Kind regards,
> Chow Loong Jin
>
>
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20090810/c81b0545/attachment.html>


More information about the Devel mailing list