Skip to content

Commit

Permalink
fix the checking for include file not open
Browse files Browse the repository at this point in the history
and pass -I option to the stage in the non installed driver
  • Loading branch information
NotFound committed Jul 11, 2011
1 parent 8d4f28d commit dfd1b7d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
15 changes: 14 additions & 1 deletion winxed.winxed
Expand Up @@ -6,6 +6,11 @@

$load 'Getopt/Obj.pbc';

// This driver must be compilable with stage 0, can't use $incldue_const
// here, so harcode the values from iglobals.pasm and libpaths.pasm
const int IGLOBALS_LIB_PATHS = 9;
const int PARROT_LIB_PATH_INCLUDE = 0;

function extname(string filename, string ext)
{
// Strip a possible .winxed extension from filename,
Expand Down Expand Up @@ -204,6 +209,14 @@ function driver_main(argv)
int use_pbc = stage > 0;

if (use_pbc) {
// Set the -I value now so the $include directive can use it.
if (incs != null) {
var interp = getinterp();
var lpaths = interp[IGLOBALS_LIB_PATHS];
var pathlib = lpaths[PARROT_LIB_PATH_INCLUDE];
pathlib.push(string(incs));
}

try {
load_bytecode(winxedbin + '.pbc');
} catch () { }
Expand All @@ -224,7 +237,7 @@ function driver_main(argv)
string pircode;
if (eval == null) {
var output;
var file;
var file;
if (pirfile == '-' &&
(targettype == TargetPir || targettype == TargetConst))
output = getstdout();
Expand Down
7 changes: 4 additions & 3 deletions winxedst1.winxed
Expand Up @@ -9299,14 +9299,15 @@ function open_include(string filename, start)
string filepath = path + filename;
try {
file = open(filepath, 'r');
file.encoding("utf8");
break;
if (file != null && ! file.is_closed())
break;
}
catch () {
}
}
if (file == null)
if (file == null || file.is_closed())
SyntaxError('File not found', start);
file.encoding("utf8");
return file;
}

Expand Down

0 comments on commit dfd1b7d

Please sign in to comment.