diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-04-10 17:47:41 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-04-10 17:47:41 -0700 |
commit | 0fef5d603198ac4563cf5e26b4989861f1f7d78d (patch) | |
tree | a734e01b1d15d0cfa00a150162a8276f361cf228 /src | |
parent | 4bafc98abadaa034749e1844784021865471966f (diff) | |
download | abc-0fef5d603198ac4563cf5e26b4989861f1f7d78d.tar.gz abc-0fef5d603198ac4563cf5e26b4989861f1f7d78d.tar.bz2 abc-0fef5d603198ac4563cf5e26b4989861f1f7d78d.zip |
Command to test console colors.
Diffstat (limited to 'src')
-rw-r--r-- | src/base/abci/abc.c | 20 | ||||
-rw-r--r-- | src/misc/util/module.make | 1 | ||||
-rw-r--r-- | src/misc/util/utilColor.c | 123 |
3 files changed, 144 insertions, 0 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 623bc216..10885cf3 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -171,6 +171,7 @@ static int Abc_CommandInter ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandBb2Wb ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandOutdec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandNodeDup ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandTestColor ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTest ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandQuaVar ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -744,6 +745,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Various", "bb2wb", Abc_CommandBb2Wb, 0 ); Cmd_CommandAdd( pAbc, "Various", "outdec", Abc_CommandOutdec, 1 ); Cmd_CommandAdd( pAbc, "Various", "nodedup", Abc_CommandNodeDup, 1 ); + Cmd_CommandAdd( pAbc, "Various", "testcolor", Abc_CommandTestColor, 0 ); Cmd_CommandAdd( pAbc, "Various", "test", Abc_CommandTest, 0 ); // Cmd_CommandAdd( pAbc, "Various", "qbf_solve", Abc_CommandTest, 0 ); @@ -10293,6 +10295,24 @@ usage: SeeAlso [] ***********************************************************************/ +int Abc_CommandTestColor( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern void Abc_ColorTest(); + Abc_ColorTest(); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); diff --git a/src/misc/util/module.make b/src/misc/util/module.make index 0765db99..5faa4c9e 100644 --- a/src/misc/util/module.make +++ b/src/misc/util/module.make @@ -1,5 +1,6 @@ SRC += src/misc/util/utilBridge.c \ src/misc/util/utilCex.c \ + src/misc/util/utilColor.c \ src/misc/util/utilFile.c \ src/misc/util/utilNam.c \ src/misc/util/utilSignal.c \ diff --git a/src/misc/util/utilColor.c b/src/misc/util/utilColor.c new file mode 100644 index 00000000..42988b0c --- /dev/null +++ b/src/misc/util/utilColor.c @@ -0,0 +1,123 @@ +/**CFile**************************************************************** + + FileName [utilColor.c] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Handling counter-examples.] + + Synopsis [Handling counter-examples.] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - Feburary 13, 2011.] + + Revision [$Id: utilColor.c,v 1.00 2011/02/11 00:00:00 alanmi Exp $] + +***********************************************************************/ + +#include <stdio.h> +#include "misc/util/abc_global.h" + + +#ifdef WIN32 +#include <windows.h> +#endif + +ABC_NAMESPACE_IMPL_START + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_ColorTest() +{ +#ifdef WIN32 + int x, y; + HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); + printf( "Background color 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15\n" ); + printf( " -----------------------------------------------\n" ); + for ( y = 0; y < 16; y++ ) + { + printf( "Foreground color %02d", y ); + for ( x = 0; x < 16; x++ ) + { + printf( " " ); + SetConsoleTextAttribute( hConsole, (WORD)(16 * y + x) ); + printf( "Hi" ); + SetConsoleTextAttribute( hConsole, 7 ); + } + printf( "\n" ); + } +#else +/* + fg[Default] = '[0m'; fg[DefaultBold] = '[1m' + + fg[Black] = '[0;30m'; fg[DarkGray] = '[1;30m' + fg[Blue] = '[0;34m'; fg[LightBlue] = '[1;34m' + fg[Green] = '[0;32m'; fg[LightGreen] = '[1;32m' + fg[Cyan] = '[0;36m'; fg[LightCyan] = '[1;36m' + fg[Red] = '[0;31m'; fg[LightRed] = '[1;31m' + fg[Purple] = '[0;35m'; fg[LightPurple] = '[1;35m' + fg[Brown] = '[0;33m'; fg[Yellow] = '[1;33m' + fg[LightGray] = '[0;37m'; fg[White] = '[1;37m' + + bg[Black] = '[0;40m'; hi[Underlined] = '[4m' + bg[Blue] = '[0;44m'; hi[Blinking] = '[5m' + bg[Green] = '[0;42m'; hi[Inverted] = '[7m' + bg[Cyan] = '[0;46m'; hi[Concealed] = '[8m' + bg[Red] = '[0;41m' + bg[Purple] = '[0;45m' + bg[Brown] = '[0;43m' + bg[LightGray] = '[0;47m' +*/ + int x, y; + printf( "Background color " ); + for ( x = 0; x < 8; x++ ) + printf( " [1;4%dm", x ); + printf( "\n" ); + for ( y = 0; y < 2; y++ ) + { + printf( "Foreground color [%dm ", y ); + for ( x = 0; x < 8; x++ ) + printf( " \033[%d;3%dm\033[%dm Hi \033[0m", y&1, y>>1, x ); + printf( "\n" ); + } + for ( y = 0; y < 16; y++ ) + { + printf( "Foreground color [%d;3%dm", y&1, y>>1 ); + for ( x = 0; x < 8; x++ ) + printf( " \033[%d;3%dm\033[1;4%dm Hi \033[0m", y&1, y>>1, x ); + printf( "\n" ); + } + printf( "\033[4mUnderlined\033[0m\n" ); + printf( "\033[5mBlinking \033[0m\n" ); + printf( "\033[7mInverted \033[0m\n" ); + printf( "\033[8mConcealed \033[0m\n" ); +#endif +} + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + +ABC_NAMESPACE_IMPL_END + |