Replies: 3 comments 1 reply
-
Good idea.
I tend to think this is a good idea as well if it does not affect the CLI mode. I am not so sure if there are other usages in the CLI mode or not. @stefanrueger and @MCUdude may chime in here. |
Beta Was this translation helpful? Give feedback.
-
TLDR, The long of it: The base function IIRC This leaves the BTW, as it's currently implemented, libavrdude functions uses a messaging system for debugging messages, warnings, and errors:
That pain of providing 29 messaging functions for an application pales in comparison to reading/writing the current 3100+ function calls for the logging/warning messaging system, in particular, as they all can be implemented via one generic function as is demonstrated by OK, now to the second matter of this issue: TLDR:
Well, the AVRDUDE project received a lot of observations along the way of this doesn't line up, that newline is too much, this doesn't look good etc. That was particularly often the case for the progress reporting interrupted by logging or error messages. It is near impossible to figure out outside the messaging system whether or not the most recent output character is a I suggest moving the progress reporting functions from |
Beta Was this translation helpful? Give feedback.
-
Progress reporting is already outside the library itself. When I first started the library segregation (and now I'm surprised this already happend in 2007 :-o), I turned progress reporting into a callback function. I just finished implementing Python callbacks for both, messaging as well as progress reporting. I completely agree that all the work that has been spent into centralizing messaging into The ability to distinguish between I'm not quite sure whether the I see why |
Beta Was this translation helpful? Give feedback.
-
In the course of working on #1714 I noticed that
avrdude_message2()
usesstdout
andstderr
through wrapper macros (and then takes extra pain to distinguish them as well as genericFILE*
streams, but that's a different matter). Looking closer, there are many other functions that output things directly tostdout
orstderr
, namely theprint_parms
anddisplay
methods ofstruct programmer_t
.Given that the purpose of segregating the library was to decouple the CLI frontend from the library backend, I think there is not much sense that library functions decide to output anything (except of catastrophic failures, e.g. unability to allocate memory) t o IO streams. Suppose someone wants to build up a GUI on top of the library, then they'd certainly prefer to get all those messages into some kind of GUI element, rather than having them on
stdout
orstderr
.I'd like to start a sweep through the code, removing those references to these
FILE*
streams except for plain CLI functionality itself (like option handling, or terminal mode).Opinions?
On a second matter, I also think that the current way
avrdude_message2()
performs the'\v'
handling is a bit too generic, given that this feature is mostly needed inside terminal mode. I'd rather tend to remove'\v'
handling from that function, and provide this functionality insideterm.c
only.Beta Was this translation helpful? Give feedback.
All reactions