generate better load error message

This commit is contained in:
Sunrim KIM (keen) 2014-08-11 11:12:32 +09:00
parent bd98dda5d0
commit 51a2a95bc1
1 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/perl
use strict;
use File::Basename qw/basename dirname/;
print <<EOL;
/**
@ -34,22 +35,26 @@ print <<EOL;
void
pic_load_piclib(pic_state *pic)
{
pic_try {
EOL
foreach my $file (@ARGV) {
print " pic_try {\n";
my $var = &escape_v($file);
my $basename = basename($file);
my $dirname = basename(dirname($file));
print " pic_load_cstr(pic, $var);\n";
}
print <<EOL;
print<<EOL
}
pic_catch {
/* error! */
fputs("fatal error: failure in loading built-in.scm\\n", stderr);
fputs("fatal error: failure in loading $dirname/$basename\\n", stderr);
fputs(pic_errmsg(pic), stderr);
abort();
}
EOL
}
print <<EOL;
#if DEBUG
puts("successfully loaded stdlib");