Faster compilation

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2464 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-04-17 15:27:12 +00:00
parent ed285baf9d
commit e720007649
9 changed files with 418 additions and 116 deletions

View file

@ -7,26 +7,65 @@
#include <windows.h>
#include <stdio.h>
#include "strlist.h"
#include <vector>
struct plugin {
int name;
int path;
int dataHandle;
int unDataHandle;
};
class PluginsList : public SortedStringListND<struct plugin>
{
public:
PluginsList() { }
~PluginsList() { }
int add(const char *name, const char *path)
{
int pos=SortedStringListND<struct plugin>::add(name);
if (pos == -1) return 1;
((struct plugin*)gr.get())[pos].path=strings.add(path, strlen(path)+1);
((struct plugin*)gr.get())[pos].dataHandle=-1;
((struct plugin*)gr.get())[pos].unDataHandle=-1;
return 0;
}
char *get(char **name, int *dataHandle=0, int *uninstDataHandle=0)
{
if (dataHandle) *dataHandle=-1;
if (uninstDataHandle) *uninstDataHandle=-1;
int v=SortedStringListND<struct plugin>::find(*name);
if (v==-1) return NULL;
strcpy(*name, (char*)strings.get()+((struct plugin*)gr.get())[v].name);
if (dataHandle) *dataHandle=((struct plugin*)gr.get())[v].dataHandle;
if (uninstDataHandle) *uninstDataHandle=((struct plugin*)gr.get())[v].unDataHandle;
return (char*)strings.get()+((struct plugin*)gr.get())[v].path;
}
void setDataHandle(const char *name, int dataHandle, int uninstDataHandle)
{
int v=SortedStringListND<struct plugin>::find(name);
if (v==-1) return;
((struct plugin*)gr.get())[v].dataHandle=dataHandle;
((struct plugin*)gr.get())[v].unDataHandle=uninstDataHandle;
}
};
class Plugins
{
public:
Plugins();
void FindCommands(char*,bool);
bool IsPluginCommand(char*);
char* GetPluginDll(int, char**, int*);
void SetDllDataHandle(int, char*, int);
protected:
DefineList m_commands;
GrowBuf m_dataHandles;
GrowBuf m_uninstDataHandles;
int m_funcsCount;
PluginsList m_list;
void GetExports(char*,bool);
};
#endif