diff options
Diffstat (limited to '')
-rw-r--r-- | src/functionplugger.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/functionplugger.cpp b/src/functionplugger.cpp new file mode 100644 index 0000000..83435ae --- /dev/null +++ b/src/functionplugger.cpp | |||
@@ -0,0 +1,59 @@ | |||
1 | #include "functionplugger.h" | ||
2 | |||
3 | #include <sys/types.h> | ||
4 | #include <dirent.h> | ||
5 | |||
6 | extern Bu::PluginInfo pluginFunctionDirName; | ||
7 | extern Bu::PluginInfo pluginFunctionDirs; | ||
8 | extern Bu::PluginInfo pluginFunctionExecute; | ||
9 | extern Bu::PluginInfo pluginFunctionExists; | ||
10 | extern Bu::PluginInfo pluginFunctionFileName; | ||
11 | extern Bu::PluginInfo pluginFunctionFiles; | ||
12 | extern Bu::PluginInfo pluginFunctionGetMakeDeps; | ||
13 | extern Bu::PluginInfo pluginFunctionMatches; | ||
14 | extern Bu::PluginInfo pluginFunctionReplace; | ||
15 | extern Bu::PluginInfo pluginFunctionTargets; | ||
16 | extern Bu::PluginInfo pluginFunctionToString; | ||
17 | extern Bu::PluginInfo pluginFunctionUnlink; | ||
18 | |||
19 | FunctionPlugger::FunctionPlugger() | ||
20 | { | ||
21 | registerBuiltinPlugin( &pluginFunctionDirName ); | ||
22 | registerBuiltinPlugin( &pluginFunctionDirs ); | ||
23 | registerBuiltinPlugin( &pluginFunctionExecute ); | ||
24 | registerBuiltinPlugin( &pluginFunctionExists ); | ||
25 | registerBuiltinPlugin( &pluginFunctionFileName ); | ||
26 | registerBuiltinPlugin( &pluginFunctionFiles ); | ||
27 | registerBuiltinPlugin( &pluginFunctionGetMakeDeps ); | ||
28 | registerBuiltinPlugin( &pluginFunctionMatches ); | ||
29 | registerBuiltinPlugin( &pluginFunctionReplace ); | ||
30 | registerBuiltinPlugin( &pluginFunctionTargets ); | ||
31 | registerBuiltinPlugin( &pluginFunctionToString ); | ||
32 | registerBuiltinPlugin( &pluginFunctionUnlink ); | ||
33 | |||
34 | DIR *dir = opendir("/usr/lib/build"); | ||
35 | if( !dir ) | ||
36 | return; | ||
37 | struct dirent *de; | ||
38 | while( (de = readdir( dir )) ) | ||
39 | { | ||
40 | if( strncmp("pluginFunction", de->d_name, 15 ) ) | ||
41 | continue; | ||
42 | |||
43 | Bu::FString sFile("/usr/lib/build/"); | ||
44 | sFile += de->d_name; | ||
45 | char *s = de->d_name; | ||
46 | for(; *s && *s != '.'; s++ ) { } | ||
47 | registerExternalPlugin( | ||
48 | sFile, | ||
49 | Bu::FString( de->d_name, (ptrdiff_t)s-(ptrdiff_t)de->d_name ) | ||
50 | ); | ||
51 | } | ||
52 | |||
53 | closedir( dir ); | ||
54 | } | ||
55 | |||
56 | FunctionPlugger::~FunctionPlugger() | ||
57 | { | ||
58 | } | ||
59 | |||