Sign in

username:

password:



Not a member?

Search rabbit-semi



Search tips

Subscribe to rabbit-semi



Ads

Discussion Groups

Discussion Groups | Rabbit-Semi | Clear stdio display

This is a group for folks designing and programming embedded systems using the Rabbit Semiconductor C-programmable microcontroller. Rabbit Semi is a spin-off from Z-World who makes a variety of embedded modules and tools. This group is not affiliated with either Rabbit or Z-World, but is a user forum for sharing ideas, asking questions, flaunting knowledge, and other typical user group stuff. The Rabbit is a powerful uC, supported by a full-featured C-compiler.

Clear stdio display - Steve Trigero - Jul 24 10:33:24 2008

Is there a way to clear the stdio window from code? I don't see an
obvious library call.

Steve



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )


Re: Clear stdio display - Jon - Jul 31 14:09:46 2008

There are a bunch of spooky console special characters. I've never
seen a real list. To clear the screen:
printf("\x1Bt");
This is cool too:
printf("\n\x1b[34m ---color--- ");
If anyone has a good cheat sheet, it would be fun for us all!

Jon

--- In r...@yahoogroups.com, Steve Trigero wrote:
>
> Is there a way to clear the stdio window from code? I don't see an
> obvious library call.
>
> Steve
>

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Clear stdio display - Kelly - Jul 31 23:04:56 2008

--- In r...@yahoogroups.com, "Jon" wrote:
> There are a bunch of spooky console special characters. I've never
> seen a real list. To clear the screen:
> printf("\x1Bt");
> This is cool too:
> printf("\n\x1b[34m ---color--- ");
> If anyone has a good cheat sheet, it would be fun for us all!

You might try http://en.wikipedia.org/wiki/ANSI_escape_code

I have no idea how many are supported.

Kelly

------------------------------------



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

Re: Re: Clear stdio display - Alan Matheson - Aug 1 0:57:53 2008

This is very useful when debugging and you want to highlight something
Set up some defines

// ***************** Defines that set the colour of STDOUT ********************
#define SET_BLACK printf("\x1b[30m");
#define SET_RED printf("\x1b[31m");
#define SET_YELLOW printf("\x1b[32m");
#define SET_BLUE printf("\x1b[33m");
#define SET_MAGENTA printf("\x1b[34m");
#define SET_CYAN printf("\x1b[35m");

Then in a debug section
#ifdef DEBUG
SET_RED
printf something you need to notice......... it comes out red
SET_BLACK
#endif
._,___

Alan Matheson


(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

RE: Re: Clear stdio display - Jerry Ryle - Aug 1 16:45:42 2008

/*** BeginHeader */
#define cANSI_NULL 0x00
#define cANSI_UPARROW 0x01
#define cANSI_DOWNARROW 0x02
#define cANSI_RIGHTARROW 0x03
#define cANSI_LEFTARROW 0x04
#define cANSI_BEEP 0x07
#define cANSI_BACKSPACE 0x08
#define cANSI_TAB 0x09

#define cANSI_ENTER 0x0D
#define cANSI_ESC 0x1B
#define cANSI_SPACE 0x20 //' '
#define cANSI_EXCLAMATION 0x21 //'!'
#define cANSI_DOUBLEQUOTE 0x22 //'"'
#define cANSI_POUND 0x23 //'#'
#define cANSI_DOLLAR 0x24 //'$'
#define cANSI_PERCENT 0x25 //'%'
#define cANSI_AMPERSAND 0x26 //'&'
#define cANSI_SINGLEQUOTE 0x27 //'''
#define cANSI_LEFTPAREN 0x28 //'('
#define cANSI_RIGHTPAREN 0x29 //')'
#define cANSI_ASTERISK 0x2A //'*'
#define cANSI_PLUS 0x2B //'+'
#define cANSI_COMMA 0x2C //','
#define cANSI_MINUS 0x2D //'-'
#define cANSI_PERIOD 0x2E //'.'
#define cANSI_FORWARDSLASH 0x2F //'/'

#define cANSI_0 0x30 //'0'
#define cANSI_1 0x31 //'1'
#define cANSI_2 0x32 //'2'
#define cANSI_3 0x33 //'3'
#define cANSI_4 0x34 //'4'
#define cANSI_5 0x35 //'5'
#define cANSI_6 0x36 //'6'
#define cANSI_7 0x37 //'7'
#define cANSI_8 0x38 //'8'
#define cANSI_9 0x39 //'9'

#define cANSI_COLON 0x3A //':'
#define cANSI_SEMICOLON 0x3B //';'
#define cANSI_LESSTHAN 0x3C //'<'
#define cANSI_EQUAL 0x3D //'='
#define cANSI_GREATERTHAN 0x3E //'>'
#define cANSI_QUESTIONMARK 0x3F //'?'
#define cANSI_AT 0x40 //'@'

#define cANSI_A 0x41 //'A'
#define cANSI_B 0x42 //'B'
#define cANSI_C 0x43 //'C'
#define cANSI_D 0x44 //'D'
#define cANSI_E 0x45 //'E'
#define cANSI_F 0x46 //'F'
#define cANSI_G 0x47 //'G'
#define cANSI_H 0x48 //'H'
#define cANSI_I 0x49 //'I'
#define cANSI_J 0x4A //'J'
#define cANSI_K 0x4B //'K'
#define cANSI_L 0x4C //'L'
#define cANSI_M 0x4D //'M'
#define cANSI_N 0x4E //'N'
#define cANSI_O 0x4F //'O'
#define cANSI_P 0x50 //'P'
#define cANSI_Q 0x51 //'Q'
#define cANSI_R 0x52 //'R'
#define cANSI_S 0x53 //'S'
#define cANSI_T 0x54 //'T'
#define cANSI_U 0x55 //'U'
#define cANSI_V 0x56 //'V'
#define cANSI_W 0x57 //'W'
#define cANSI_X 0x58 //'X'
#define cANSI_Y 0x59 //'Y'
#define cANSI_Z 0x5A //'Z'

#define cANSI_LBRACKET 0x5B //'['
#define cANSI_BACKSLASH 0x5C //'\'
#define cANSI_RBRACKET 0x5D //']'
#define cANSI_CARET 0x5E //'^'
#define cANSI_UNDERSCORE 0x5F //'_'
#define cANSI_TICK 0x60 //'`'

#define cANSI_a 0x61 //'a'
#define cANSI_b 0x62 //'b'
#define cANSI_c 0x63 //'c'
#define cANSI_d 0x64 //'d'
#define cANSI_e 0x65 //'e'
#define cANSI_f 0x66 //'f'
#define cANSI_g 0x67 //'g'
#define cANSI_h 0x68 //'h'
#define cANSI_i 0x69 //'i'
#define cANSI_j 0x6A //'j'
#define cANSI_k 0x6B //'k'
#define cANSI_l 0x6C //'l'
#define cANSI_m 0x6D //'m'
#define cANSI_n 0x6E //'n'
#define cANSI_o 0x6F //'o'
#define cANSI_p 0x70 //'p'
#define cANSI_q 0x71 //'q'
#define cANSI_r 0x72 //'r'
#define cANSI_s 0x73 //'s'
#define cANSI_t 0x74 //'t'
#define cANSI_u 0x75 //'u'
#define cANSI_v 0x76 //'v'
#define cANSI_w 0x77 //'w'
#define cANSI_x 0x78 //'x'
#define cANSI_y 0x79 //'y'
#define cANSI_z 0x7A //'z'

#define cANSI_LBRACE 0x7B //'{'
#define cANSI_PIPE 0x7C //'|'
#define cANSI_RBRACE 0x7D //'}'
#define cANSI_TILDE 0x7E //'~'
#define cANSI_EOF 0x7F

#define sANSI_NEWLINE "\n\r"

#define sANSI_INTENSE "\x1B[1m"
#define sANSI_UNDERLINE "\x1B[4m"
#define sANSI_BLINK "\x1B[5m"
#define sANSI_REVERSE "\x1B[7m"
#define sANSI_INVISIBLE "\x1B[8m"
#define sANSI_NOATTR "\x1B[0m"

#define sANSI_FGBLACK "\x1B[30m"
#define sANSI_BGBLACK "\x1B[40m"
#define sANSI_FGRED "\x1B[31m"
#define sANSI_BGRED "\x1B[41m"
#define sANSI_FGGREEN "\x1B[32m"
#define sANSI_BGGREEN "\x1B[42m"
#define sANSI_FGYELLOW "\x1B[33m"
#define sANSI_BGYELLOW "\x1B[43m"
#define sANSI_FGBLUE "\x1B[34m"
#define sANSI_BGBLUE "\x1B[34m"
#define sANSI_FGMAGENTA "\x1B[35m"
#define sANSI_BGMAGENTA "\x1B[45m"
#define sANSI_FGCYAN "\x1B[36m"
#define sANSI_BGCYAN "\x1B[46m"
#define sANSI_FGWHITE "\x1B[37m"
#define sANSI_BGWHITE "\x1B[47m"

#define sANSI_PING "\x1B[5n"
#define sANSI_NOWRAP "\x1B[7l"
#define sANSI_BACKSPACE "\x1B[1D\x1B[K"
#define sANSI_DELETELINE "\x1B[K"
#define sANSI_CLRSCR "\x1B[2J"
#define sANSI_CURSORMODE "\x1B[?1l"
#define sANSI_SAVECURSOR "\x1B[s"
#define sANSI_RESTORECURSOR "\x1B[u"

/*** EndHeader */
/*** BeginHeader ANSIgotox, ANSIgotoxy, ANSIgotoy, */
void ANSIgotoxy(int X, int Y, void* terminalID);
void ANSIgotox(int X, void* terminalID);
void ANSIgotoy(int Y, void* terminalID);

/*** EndHeader */

void ANSIgotoxy(int X, int Y)
{
printf("\x1B[%d;%dH",Y,X);
}

void ANSIgotox(int X)
{
printf("\x1B[;%dH",X);
}

void ANSIgotoy(int Y)
{
printf("\x1B[%dH",Y);
}



(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )

RE: Re: Clear stdio display - Jerry Ryle - Aug 1 16:55:43 2008

Oops. I just realized that the original request was for the Dynamic C stdio window. I'm not certain how many of the ANSI control characters that actually supports. My file specifically targeted an ANSI terminal such as PuTTY or Hyperterminal. Hopefully someone will still find it useful.

--Jerry

From: Jerry Ryle
Sent: Friday, August 01, 2008 1:46 PM
To: r...@yahoogroups.com
Subject: RE: [rabbit-semi] Re: Clear stdio display

I've attached our "ANSITERM.c" to this response. It is probably far from a comprehensive list, but has some useful definitions we've used in the past (the interesting ones are towards the end). I just tweaked this file a bit for public release & I don't have Dynamic C installed, so I'm not certain it will compile as-is. It should still serve as a decent reference though.

--Jerry

MindTribe. Engineering Moxie.
www.mindtribe.com

Jerry Ryle
Director of Software Engineering
d: (650) 324-9432 x106
e: j...@mindtribe.com
b: blog.mindtribe.com

From: r...@yahoogroups.com [mailto:r...@yahoogroups.com] On Behalf Of Jon
Sent: Thursday, July 31, 2008 11:10 AM
To: r...@yahoogroups.com
Subject: [rabbit-semi] Re: Clear stdio display
There are a bunch of spooky console special characters. I've never
seen a real list. To clear the screen:
printf("\x1Bt");
This is cool too:
printf("\n\x1b[34m ---color--- ");
If anyone has a good cheat sheet, it would be fun for us all!

Jon

--- In r...@yahoogroups.com, Steve Trigero wrote:
>
> Is there a way to clear the stdio window from code? I don't see an
> obvious library call.
>
> Steve
>


(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )