Go to Post Not sure if its fair to call this or not yet. Back a group of dedicated teenagers far enough into a corner, and they're gonna find a way out. - Racer26 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-04-2012, 16:22
yabberyabber yabberyabber is offline
Registered User
AKA: Andrew Nelson
FRC #0973
Team Role: College Student
 
Join Date: Jan 2010
Rookie Year: 2008
Location: SLO, Ca and/or Seattle, WA
Posts: 10
yabberyabber is an unknown quantity at this point
Lightbulb putting color in printf's?

I know almost all terminal emulators support displaying colors, and was wondering if the FRC netconsole also supported them. We've tried the standard VT100 escape sequences, and those didn't work, but I know there are other terminal standards. Does anyone know anything about this?

Thanks in advance for your responses. I know it's not very important, but I think it would be nice not to have to scroll through lines of text just to find what you're looking for.
Reply With Quote
  #2   Spotlight this post!  
Unread 10-04-2012, 22:00
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: putting color in printf's?

If netconsole does not support color fonts, I would like to make a feature request for next year. In particular, I would like to have support for the following ANSI escape sequences. It's nice to be able to use different colors for messages such as information, warnings and errors. Since vxWorks as well as WPILib also spew tons of output to netconsole, if we could change color of our messages, it is a lot easier to spot them. It would be great if netconsole even allows filtering the messages by color (e.g. I don't want to see messages in green color).
Code:
#define ESC_PREFIX              "\x1b["
#define ESC_SUFFIX              "m"
#define ESC_SEP                 ";"
#define SGR_RESET               "0"
#define SGR_BRIGHT              "1"
#define SGR_DIM                 "2"
#define SGR_ITALIC              "3"
#define SGR_UNDERLINE           "4"
#define SGR_BLINKSLOW           "5"
#define SGR_BLINKFAST           "6"
#define SGR_REVERSE             "7"
#define SGR_HIDDEN              "8"
#define SGR_CROSSEDOUT          "9"
#define SGR_FG_BLACK            "30"
#define SGR_FG_RED              "31"
#define SGR_FG_GREEN            "32"
#define SGR_FG_YELLOW           "33"
#define SGR_FG_BLUE             "34"
#define SGR_FG_MAGENTA          "35"
#define SGR_FG_CYAN             "36"
#define SGR_FG_WHITE            "37"
#define SGR_BG_BLACK            "40"
#define SGR_BG_RED              "41"
#define SGR_BG_GREEN            "42"
#define SGR_BG_YELLOW           "43"
#define SGR_BG_BLUE             "44"
#define SGR_BG_MAGENTA          "45"
#define SGR_BG_CYAN             "46"
#define SGR_BG_WHITE            "47"
#define ESC_RESET               ESC_PREFIX ESC_SUFFIX
#define ESC_BLINKSLOW           ESC_PREFIX SGR_BLINKSLOW ESC_SUFFIX
#define ESC_BLINKFAST           ESC_PREFIX SGR_BLINKFAST ESC_SUFFIX
#define ESC_FG_BLACK            ESC_PREFIX SGR_FG_BLACK    ESC_SUFFIX
#define ESC_FG_RED              ESC_PREFIX SGR_FG_RED      ESC_SUFFIX
#define ESC_FG_GREEN            ESC_PREFIX SGR_FG_GREEN    ESC_SUFFIX
#define ESC_FG_YELLOW           ESC_PREFIX SGR_FG_YELLOW   ESC_SUFFIX
#define ESC_FG_BLUE             ESC_PREFIX SGR_FG_BLUE     ESC_SUFFIX
#define ESC_FG_MAGENTA          ESC_PREFIX SGR_FG_MAGENTA  ESC_SUFFIX
#define ESC_FG_CYAN             ESC_PREFIX SGR_FG_CYAN     ESC_SUFFIX
#define ESC_FG_WHITE            ESC_PREFIX SGR_FG_WHITE    ESC_SUFFIX
#define ESC_BG_BLACK            ESC_PREFIX SGR_BG_BLACK    ESC_SUFFIX
#define ESC_BG_RED              ESC_PREFIX SGR_BG_RED      ESC_SUFFIX
#define ESC_BG_GREEN            ESC_PREFIX SGR_BG_GREEN    ESC_SUFFIX
#define ESC_BG_YELLOW           ESC_PREFIX SGR_BG_YELLOW   ESC_SUFFIX
#define ESC_BG_BLUE             ESC_PREFIX SGR_BG_BLUE     ESC_SUFFIX
#define ESC_BG_MAGENTA          ESC_PREFIX SGR_BG_MAGENTA  ESC_SUFFIX
#define ESC_BG_CYAN             ESC_PREFIX SGR_BG_CYAN     ESC_SUFFIX
#define ESC_BG_WHITE            ESC_PREFIX SGR_BG_WHITE    ESC_SUFFIX
#define ESC_FGB_BLACK           ESC_PREFIX SGR_FG_BLACK    \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_FGB_RED             ESC_PREFIX SGR_FG_RED      \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_FGB_GREEN           ESC_PREFIX SGR_FG_GREEN    \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_FGB_YELLOW          ESC_PREFIX SGR_FG_YELLOW   \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_FGB_BLUE            ESC_PREFIX SGR_FG_BLUE     \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_FGB_MAGENTA         ESC_PREFIX SGR_FG_MAGENTA  \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_FGB_CYAN            ESC_PREFIX SGR_FG_CYAN     \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_FGB_WHITE           ESC_PREFIX SGR_FG_WHITE    \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_BGB_BLACK           ESC_PREFIX SGR_BG_BLACK    \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_BGB_RED             ESC_PREFIX SGR_BG_RED      \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_BGB_GREEN           ESC_PREFIX SGR_BG_GREEN    \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_BGB_YELLOW          ESC_PREFIX SGR_BG_YELLOW   \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_BGB_BLUE            ESC_PREFIX SGR_BG_BLUE     \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_BGB_MAGENTA         ESC_PREFIX SGR_BG_MAGENTA  \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_BGB_CYAN            ESC_PREFIX SGR_BG_CYAN     \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
#define ESC_BGB_WHITE           ESC_PREFIX SGR_BG_WHITE    \
                                ESC_SEP SGR_BRIGHT ESC_SUFFIX
__________________

Last edited by mikets : 11-04-2012 at 18:29.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:33.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi