aboutsummaryrefslogtreecommitdiff
path: root/src/functionplugger.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/functionplugger.cpp59
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
6extern Bu::PluginInfo pluginFunctionDirName;
7extern Bu::PluginInfo pluginFunctionDirs;
8extern Bu::PluginInfo pluginFunctionExecute;
9extern Bu::PluginInfo pluginFunctionExists;
10extern Bu::PluginInfo pluginFunctionFileName;
11extern Bu::PluginInfo pluginFunctionFiles;
12extern Bu::PluginInfo pluginFunctionGetMakeDeps;
13extern Bu::PluginInfo pluginFunctionMatches;
14extern Bu::PluginInfo pluginFunctionReplace;
15extern Bu::PluginInfo pluginFunctionTargets;
16extern Bu::PluginInfo pluginFunctionToString;
17extern Bu::PluginInfo pluginFunctionUnlink;
18
19FunctionPlugger::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
56FunctionPlugger::~FunctionPlugger()
57{
58}
59