Merge pull request #192 from KeenS/better-load-error-message
generate better load error message
This commit is contained in:
commit
c7f3346be6
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use File::Basename qw/basename dirname/;
|
||||||
|
|
||||||
print <<EOL;
|
print <<EOL;
|
||||||
/**
|
/**
|
||||||
|
@ -34,22 +35,26 @@ print <<EOL;
|
||||||
void
|
void
|
||||||
pic_load_piclib(pic_state *pic)
|
pic_load_piclib(pic_state *pic)
|
||||||
{
|
{
|
||||||
pic_try {
|
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
foreach my $file (@ARGV) {
|
foreach my $file (@ARGV) {
|
||||||
|
print " pic_try {\n";
|
||||||
my $var = &escape_v($file);
|
my $var = &escape_v($file);
|
||||||
|
my $basename = basename($file);
|
||||||
|
my $dirname = basename(dirname($file));
|
||||||
print " pic_load_cstr(pic, $var);\n";
|
print " pic_load_cstr(pic, $var);\n";
|
||||||
}
|
print<<EOL
|
||||||
|
|
||||||
print <<EOL;
|
|
||||||
}
|
}
|
||||||
pic_catch {
|
pic_catch {
|
||||||
/* error! */
|
/* 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);
|
fputs(pic_errmsg(pic), stderr);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
EOL
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<EOL;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
puts("successfully loaded stdlib");
|
puts("successfully loaded stdlib");
|
||||||
|
|
Loading…
Reference in New Issue