mirror of
https://github.com/nasa/trick.git
synced 2025-04-16 07:26:48 +00:00
Standardize missing S_define include error message
trick_print is not flexible enough for the kind of formatting I want to do, so I added a new function, trick_formatted_print, that takes alternating control sequences and strings to allow any kind of formatting in the console. Like trick_print, it also prints to a file with the control sequences removed. Refs #436
This commit is contained in:
parent
1dbeb3e2d4
commit
0bb5995397
@ -266,8 +266,7 @@ sub parse_s_define ($) {
|
||||
}
|
||||
}
|
||||
if ( $found == 0 ) {
|
||||
trick_print( $$sim_ref{fh}, "[1m[33mWarning [39mS_define\n", "title_white", $$sim_ref{args}{v} );
|
||||
trick_print( $$sim_ref{fh}, " Could not find dependency \"[1m$object_file\"\n", "title_white", $$sim_ref{args}{v} );
|
||||
trick_formatted_print($$sim_ref{fh}, "[1m[33m", "Warning ", "[39m", "S_define\n", "[0m", " Could not find dependency \"", "[1m", "$object_file", "[0m", "\"\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -849,7 +848,7 @@ sub handle_compiler_directive($$) {
|
||||
($rel_file_name) = $1 ;
|
||||
$file_name = find_header_file($rel_file_name , \@{$$sim_ref{inc_paths}}) ;
|
||||
if ( $file_name eq "" ) {
|
||||
trick_print($$sim_ref{fh}, "could not find $rel_file_name\n" , "title_red", $$sim_ref{args}{v});
|
||||
trick_formatted_print($$sim_ref{fh}, "[91m[1m", "Error ", "[0m", "Could not find included file \"", "[1m", "$rel_file_name", "[0m", "\"\n") ;
|
||||
exit -1 ;
|
||||
}
|
||||
trick_print($$sim_ref{fh}," Found include: $file_name\n", "debug_white", $$sim_ref{args}{v}) ;
|
||||
|
@ -2,7 +2,7 @@ package trick_print ;
|
||||
|
||||
use Exporter ();
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(trick_print);
|
||||
@EXPORT = qw(trick_print trick_formatted_print);
|
||||
|
||||
use strict ;
|
||||
|
||||
@ -42,7 +42,7 @@ sub trick_print($$$$) {
|
||||
print $fh "$message" ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# print the message to the screen
|
||||
if ( $verbose >= $message_type{$mt}{level} ) {
|
||||
$message =~ s/(\n)?$/[00m$1/s ;
|
||||
@ -50,4 +50,14 @@ sub trick_print($$$$) {
|
||||
}
|
||||
}
|
||||
|
||||
sub trick_formatted_print {
|
||||
my ($file, @strings) = @_;
|
||||
for (my $i = 0; $i < @strings; ++$i) {
|
||||
print $strings[$i];
|
||||
if ($i % 2) {
|
||||
print $file $strings[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user