Removed the print_use_colours feature.

More nuisance than help at this stage; removed.
This commit is contained in:
Simon Brooke 2019-02-07 15:42:01 +00:00
parent 93c40b7d27
commit 27411689c9
3 changed files with 6 additions and 47 deletions

View file

@ -99,11 +99,8 @@ int main( int argc, char *argv[] ) {
exit( 1 ); exit( 1 );
} }
while ( ( option = getopt( argc, argv, "cpdv:" ) ) != -1 ) { while ( ( option = getopt( argc, argv, "pdv:" ) ) != -1 ) {
switch ( option ) { switch ( option ) {
case 'c':
print_use_colours = true;
break;
case 'd': case 'd':
dump_at_end = true; dump_at_end = true;
break; break;

View file

@ -27,12 +27,6 @@
#include "psse_time.h" #include "psse_time.h"
#include "vectorspace.h" #include "vectorspace.h"
/**
* Whether or not we colorise output.
* \todo this should be a Lisp symbol binding, not a C variable.
*/
int print_use_colours = 0;
/** /**
* print all the characters in the symbol or string indicated by `pointer` * print all the characters in the symbol or string indicated by `pointer`
* onto this `output`; if `pointer` does not indicate a string or symbol, * onto this `output`; if `pointer` does not indicate a string or symbol,
@ -89,19 +83,10 @@ print_list_contents( URL_FILE * output, struct cons_pointer pointer,
} }
void print_list( URL_FILE * output, struct cons_pointer pointer ) { void print_list( URL_FILE * output, struct cons_pointer pointer ) {
if ( print_use_colours ) {
url_fwprintf( output, L"%s(%s", "\x1B[31m", "\x1B[39m" );
} else {
url_fputws( L"(", output ); url_fputws( L"(", output );
};
print_list_contents( output, pointer, false ); print_list_contents( output, pointer, false );
if ( print_use_colours ) {
url_fwprintf( output, L"%s)%s", "\x1B[31m", "\x1B[39m" );
} else {
url_fputws( L")", output ); url_fputws( L")", output );
} }
}
void print_map( URL_FILE * output, struct cons_pointer map) { void print_map( URL_FILE * output, struct cons_pointer map) {
@ -178,8 +163,7 @@ struct cons_pointer print( URL_FILE * output, struct cons_pointer pointer ) {
print_list( output, pointer ); print_list( output, pointer );
break; break;
case EXCEPTIONTV: case EXCEPTIONTV:
url_fwprintf( output, L"\n%sException: ", url_fwuts( L"\nException: ", output );
print_use_colours ? "\x1B[31m" : "" );
dump_stack_trace( output, pointer ); dump_stack_trace( output, pointer );
break; break;
case FUNCTIONTV: case FUNCTIONTV:
@ -190,17 +174,11 @@ struct cons_pointer print( URL_FILE * output, struct cons_pointer pointer ) {
case INTEGERTV:{ case INTEGERTV:{
struct cons_pointer s = integer_to_string( pointer, 10 ); struct cons_pointer s = integer_to_string( pointer, 10 );
inc_ref( s ); inc_ref( s );
if ( print_use_colours ) {
url_fputws( L"\x1B[34m", output );
}
print_string_contents( output, s ); print_string_contents( output, s );
dec_ref( s ); dec_ref( s );
} }
break; break;
case KEYTV: case KEYTV:
if ( print_use_colours ) {
url_fputws( L"\x1B[1;33m", output );
}
url_fputws( L":", output ); url_fputws( L":", output );
print_string_contents( output, pointer ); print_string_contents( output, pointer );
break; break;
@ -254,22 +232,13 @@ struct cons_pointer print( URL_FILE * output, struct cons_pointer pointer ) {
buffer[i] = '\0'; buffer[i] = '\0';
} }
} }
if ( print_use_colours ) {
url_fputws( L"\x1B[34m", output );
}
url_fwprintf( output, L"%s", buffer ); url_fwprintf( output, L"%s", buffer );
free( buffer ); free( buffer );
break; break;
case STRINGTV: case STRINGTV:
if ( print_use_colours ) {
url_fputws( L"\x1B[36m", output );
}
print_string( output, pointer ); print_string( output, pointer );
break; break;
case SYMBOLTV: case SYMBOLTV:
if ( print_use_colours ) {
url_fputws( L"\x1B[1;33m", output );
}
print_string_contents( output, pointer ); print_string_contents( output, pointer );
break; break;
case SPECIALTV: case SPECIALTV:
@ -297,17 +266,11 @@ struct cons_pointer print( URL_FILE * output, struct cons_pointer pointer ) {
break; break;
default: default:
fwprintf( stderr, fwprintf( stderr,
L"%sError: Unrecognised tag value %d (%c%c%c%c)\n", L"Error: Unrecognised tag value %d (%4.4s)\n",
print_use_colours ? "\x1B[31m" : "", cell.tag.value, &cell.tag.bytes[0] );
cell.tag.value, cell.tag.bytes[0], cell.tag.bytes[1],
cell.tag.bytes[2], cell.tag.bytes[3] );
break; break;
} }
if ( print_use_colours ) {
url_fputws( L"\x1B[39m", output );
}
return pointer; return pointer;
} }

View file

@ -16,6 +16,5 @@
struct cons_pointer print( URL_FILE * output, struct cons_pointer pointer ); struct cons_pointer print( URL_FILE * output, struct cons_pointer pointer );
void println( URL_FILE * output ); void println( URL_FILE * output );
extern int print_use_colours;
#endif #endif