aboutsummaryrefslogtreecommitdiff
path: root/src/context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/context.cpp')
-rw-r--r--src/context.cpp48
1 files changed, 21 insertions, 27 deletions
diff --git a/src/context.cpp b/src/context.cpp
index efe8098..64b3bd0 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -7,18 +7,7 @@
7#include "profile.h" 7#include "profile.h"
8#include "view.h" 8#include "view.h"
9 9
10#include "functionreplace.h" 10#include "functionplugger.h"
11#include "functionexists.h"
12#include "functionfiles.h"
13#include "functionexecute.h"
14#include "functionmatches.h"
15#include "functiontostring.h"
16#include "functionunlink.h"
17#include "functiontargets.h"
18#include "functiondirs.h"
19#include "functiongetmakedeps.h"
20#include "functionfilename.h"
21#include "functiondirname.h"
22 11
23#include <bu/process.h> 12#include <bu/process.h>
24#include <bu/sio.h> 13#include <bu/sio.h>
@@ -27,18 +16,6 @@ using namespace Bu;
27Context::Context() : 16Context::Context() :
28 pView( NULL ) 17 pView( NULL )
29{ 18{
30 addFunction( new FunctionReplace() );
31 addFunction( new FunctionExists() );
32 addFunction( new FunctionFiles() );
33 addFunction( new FunctionExecute() );
34 addFunction( new FunctionMatches() );
35 addFunction( new FunctionToString() );
36 addFunction( new FunctionUnlink() );
37 addFunction( new FunctionTargets() );
38 addFunction( new FunctionDirs() );
39 addFunction( new FunctionGetMakeDeps() );
40 addFunction( new FunctionFileName() );
41 addFunction( new FunctionDirName() );
42 pushScope(); 19 pushScope();
43} 20}
44 21
@@ -178,7 +155,16 @@ Variable Context::call( const Bu::FString &sName, Variable &input,
178{ 155{
179 if( !hFunction.has( sName ) ) 156 if( !hFunction.has( sName ) )
180 { 157 {
181 throw Bu::ExceptionBase("Unknown function called: %s", sName.getStr() ); 158 // Try to load the function...
159 try
160 {
161 addFunction( FunctionPlugger::getInstance().instantiate( sName ) );
162 }
163 catch(...)
164 {
165 throw Bu::ExceptionBase("Unknown function called: %s",
166 sName.getStr() );
167 }
182 } 168 }
183 return hFunction.get( sName )->call( input, lParams ); 169 return hFunction.get( sName )->call( input, lParams );
184} 170}
@@ -290,8 +276,16 @@ void Context::buildTargetTree( Runner &r )
290 continue; 276 continue;
291 277
292 StrList lNewIns; // The new "changed" inputs for this target 278 StrList lNewIns; // The new "changed" inputs for this target
293 279
294 Rule *pMaster = hRule.get( (*i)->getRule() ); 280 Rule *pMaster;
281 try
282 {
283 pMaster = hRule.get( (*i)->getRule() );
284 }
285 catch( Bu::HashException &e )
286 {
287 throw Bu::ExceptionBase("Unknown rule: %s", (*i)->getRule().getStr() );
288 }
295 289
296 for( StrList::const_iterator j = (*i)->getInputList().begin(); j; j++ ) 290 for( StrList::const_iterator j = (*i)->getInputList().begin(); j; j++ )
297 { 291 {