avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avrdude-dev] code restructuring - using C99 or not?


From: Axel Wachtler
Subject: Re: [avrdude-dev] code restructuring - using C99 or not?
Date: Sat, 28 Jul 2012 11:08:44 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1



On 26.07.2012 11:30, Joerg Wunsch wrote:
As Axel Wachtler wrote:

My intention would be to move the "if(verbose>SOMETHING)" into
the macro itself, this would make the code easier to read.

PRINT(WARNING, "foo=%d\n", 42);

Sounds reasonable.

I'd call it MESSAGE() rather than PRINT().

Agreed, MESSAGE is the better name for this Macro.

Note that there's currently a distintion between -q and -qq.  The
latter makes it really quite regarding all informational messages,
while a single -q IMHO only silences the progress bar but still
displays some other messages.

Ok, I will make the patch so that the current output of avrdude is
retained as it is now.

so I would prefer a callback function that gets a simple string and
all the formatting is done in the central printing function.

It's OK, but I think the callback function should also get the
"severity" indication (rather than performing the yes/no decision
inside a macro or such), so it can decide by itself whether it has to
act upon the message, and how.  E.g., a GUI sitting on top of the
shared lib might opt to display error or warning messages in a popup,
informational messages in a status window, and log debugging messages
only internally, to be displayed upon request of the user (or to be
written in to a file).

Sounds good, the function called by MESSAGE() will always generate the string and pass the string together with the severity parameter to the user callback.

This has also the advantage that the current global variables "quite"
and "verbose" could be made static to the existing main.c, and no
longer need to be known inside the library.

Sounds good.

Cheers, Axel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]