aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-11-08 00:17:47 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-11-11 18:41:06 +0300
commit07e0d37aba5cd72ff2d53eda654a4d5466e38627 (patch)
tree80ab6452b0fc489833fb911926ca872e51ec1575 /libbuild2/file.cxx
parent5935476651cd063a53d08ec33b04513a7a8127e3 (diff)
Use path_name for `-` to stdin/stdout translation
Diffstat (limited to 'libbuild2/file.cxx')
-rw-r--r--libbuild2/file.cxx31
1 files changed, 17 insertions, 14 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index 2bc9af6..8d59d7c 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -163,25 +163,29 @@ namespace build2
{
tracer trace ("source");
- const path& bf (l.name ());
+ const path_name& fn (l.name ());
try
{
- l5 ([&]{trace << "sourcing " << bf;});
+ l5 ([&]{trace << "sourcing " << fn;});
parser p (root.ctx, boot);
p.parse_buildfile (l, root, base);
}
catch (const io_error& e)
{
- fail << "unable to read buildfile " << bf << ": " << e;
+ fail << "unable to read buildfile " << fn << ": " << e;
}
}
static void
- source (scope& root, scope& base, istream& is, const path& bf, bool boot)
+ source (scope& root,
+ scope& base,
+ istream& is,
+ const path_name& in,
+ bool boot)
{
- lexer l (is, bf);
+ lexer l (is, in);
source (root, base, l, boot);
}
@@ -191,10 +195,8 @@ namespace build2
path_name fn (bf);
try
{
- // @@ PATH_NAME TODO
- //
ifdstream ifs;
- return source (root, base, open_file_or_stdin (fn, ifs), bf /* fn */, boot);
+ return source (root, base, open_file_or_stdin (fn, ifs), fn, boot);
}
catch (const io_error& e)
{
@@ -209,9 +211,9 @@ namespace build2
}
void
- source (scope& root, scope& base, istream& is, const path& bf)
+ source (scope& root, scope& base, istream& is, const path_name& in)
{
- source (root, base, is, bf, false);
+ source (root, base, is, in, false /* boot */);
}
void
@@ -525,7 +527,7 @@ namespace build2
pair<value, bool>
extract_variable (context& ctx, lexer& l, const variable& var)
{
- const path& bf (l.name ());
+ const path_name& fn (l.name ());
try
{
@@ -553,7 +555,7 @@ namespace build2
}
catch (const io_error& e)
{
- fail << "unable to read buildfile " << bf << ": " << e << endf;
+ fail << "unable to read buildfile " << fn << ": " << e << endf;
}
}
@@ -563,7 +565,8 @@ namespace build2
const path& bf,
const variable& var)
{
- lexer l (is, bf);
+ path_name in (bf);
+ lexer l (is, in);
return extract_variable (ctx, l, var);
}
@@ -1665,7 +1668,7 @@ namespace build2
// name?
//
parser p (ctx);
- names v (p.parse_export_stub (ifs, es, gs, ts));
+ names v (p.parse_export_stub (ifs, path_name (es), gs, ts));
// If there were no export directive executed in an export stub, assume
// the target is not exported.