[Wheat-cvs] r1/app farm.cpp,1.6,1.7
Status: Pre-Alpha
Brought to you by:
mark_lentczner
From: Mark L. <mar...@us...> - 2005-02-21 07:41:23
|
Update of /cvsroot/wheat/r1/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20727/app Modified Files: farm.cpp Log Message: change Compiler interface - source is now a string or byte-array in memory - return value is a Result object - Result object can be turned into a throw Exception if needed added new TestUtil::SetupCompile - unit tests that compile now make use of this (or a sub-class) the format of the thrown exceptions has changed - it is expected that soon Farm will use the Result object and won't rely on this anymore... packages loaded at start up now must have their source code mounted - compiler supports file objects' convention of having the actual byte-array at the "contents" member, this is needed for boot-strapping the system (since we can't send "as-bytearray" to a file before the code for file has compiled!) - we'll need this anyway so we can have run-time errors point to the source into system code Whew! Index: farm.cpp =================================================================== RCS file: /cvsroot/wheat/r1/app/farm.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- farm.cpp 16 Feb 2005 08:59:52 -0000 1.6 +++ farm.cpp 21 Feb 2005 07:40:42 -0000 1.7 @@ -31,25 +31,25 @@ Argument sourcePath(f); Argument targetPath(f); - Local sourceLink(f); - sourceLink = Link(sourcePath.asPath()); + Local source(f); + source = Link(sourcePath.asPath()); auto_ptr<pt::instm> sourceStream; - if (sourceLink.isByteArray()) { - auto_ptr<pt::instm> s = sourceLink.asByteArray()->stream(); - sourceStream = s; + if (source.isByteArray()) { + source = source.send("as-bytearray").asis(); } - else if (sourceLink.isString()) { - ByteArray b = MemoryByteArray::build(sourceLink.asString()); - auto_ptr<pt::instm> s = b->stream(); - sourceStream = s; + else if (source.isString()) { + source = source.send("as-string").asis(); } else { throw Exception("applications/farm/exception/no-source"); } Path target = targetPath.asPath(); - Compiler::compile(*sourceStream, target); + + Compiler::Result r; + r = Compiler::compile(source.send("absolute-path").asPath(), target); + r.throwIfFailure(); return Return(f, True()); } |