From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30263 invoked by alias); 27 May 2007 10:12:23 -0000 Received: (qmail 30254 invoked by uid 22791); 27 May 2007 10:12:22 -0000 X-Spam-Check-By: sourceware.org Received: from stelecom.gomel.by (HELO stelecom.gomel.by) (82.209.213.61) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 27 May 2007 10:12:19 +0000 Received: from localhost (localhost [127.0.0.1]) by stelecom.gomel.by (Postfix) with ESMTP id 874ABB01041F for ; Sun, 27 May 2007 13:12:16 +0300 (EEST) Received: from stelecom.gomel.by ([127.0.0.1]) by localhost (stelecom.gomel.by [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14943-18 for ; Sun, 27 May 2007 13:12:15 +0300 (EEST) Received: from localhost (unknown [82.209.209.166]) by stelecom.gomel.by (Postfix) with ESMTP id 94325B01961D for ; Sun, 27 May 2007 13:12:14 +0300 (EEST) Date: Sun, 27 May 2007 14:42:00 -0000 From: Sergei Gavrikov To: ecos-discuss@ecos.sourceware.org Message-ID: <20070527101131.GA8574@ubuntu> References: <20070526163810.GA13155@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Re: diag_printf refuses to print ANSI escape sequences? X-SW-Source: 2007-05/txt/msg00136.txt.bz2 On Sat, May 26, 2007 at 08:19:40PM +0000, Grant Edwards wrote: > On 2007-05-26, Sergei Gavrikov wrote: > > On Sat, May 26, 2007 at 03:19:42PM +0000, Grant Edwards wrote: > >> In the "not a big deal" department... > >> > >> I'm trying to send ANSI escape sequences using diag_printf, and > >> diag_printf refuses. If I put the escape character in the format > >> string it says > >> > >> >> FB93FFDC> > >> > >> If there's an escape character in a string that is to be printed using > >> the "%s" format, it says: > >> > >> > >> > >> I understand that it's useful to attempt to avoid printing random > >> binary garbage, but I would think that ASCII ESC might be allowed in > >> strings. > >> > >> I've found that insterting the escape characters using %c works, but > >> that's a bit awkward. > > > > There are nice diag_dump_buf* functions in the eCos infra layer > > (cyg/infra/diag.h). I do use that. > > I'm aware of the daig_dump_buf fuctions, but I don't see how > they solve my problem. AFAIR, they dump out buffer contents in > hex. What I'm trying to do is: > > diag_printf("\033[34mBlue Text \033[31mRed Text \033[mNormal Text\n"); > > diag_printf refuses to do that, so I have to do something like > this instead: > > diag_printf("%c[34mBlue Text %c[31mRed Text %c[mNormal Text\n",033,033,033); > > and that seems awkward to me. > > One could argue that embedding escape seqences in strings is a > bit hackish... > Ah, the diag_printf() for me always did mean the diagnostic (read debug) output function, but it didn't mean for me any type of the printf+send. IMHO, those diag_*() functions should be the light weight things. I wouldn't see the complex parsing in the diag_printf(), diag_sprintf() functions. What's about falk which use the eCos minimal template in the first? It seems, it's easy to use either macros, for example, COLOR_PRINTF, COLOR_PUTS, etc. something like this #define COLOR_PRINTF( fgcolor, bgcolor, fmt, ...) \ ... and to use the diag_write_char() in the body of the macro to output those special characters, or just own whiptail functions, i.e. something like the cprintf(), cputchar(), cputs(). But the question is staying for me, Is the colorized output deal for diag_printf? I know that there are dumb terminals, GDB, etc. there. Those things are deal for diag_printf(), aren't they? IMHO, diag_led can produce the colorized output, but diag_printf shouldn't do such things :-) -- Sergei > -- > Grant Edwards grante Yow! NEWARK has been > at REZONED!! DES MOINES has > visi.com been REZONED!! > > > -- > Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos > and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss