convert to plug-in library and never unload so user variables are saved
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5843 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
608b642375
commit
06ab0c6314
6 changed files with 24 additions and 114 deletions
|
@ -2,10 +2,6 @@
|
|||
#include "MyMath.h"
|
||||
#include "Math.h"
|
||||
|
||||
unsigned int g_stringsize;
|
||||
stack_t **g_stacktop;
|
||||
char *g_variables;
|
||||
|
||||
#ifdef _DEBUG_LEAKS
|
||||
|
||||
#include <crtdbg.h>
|
||||
|
@ -38,40 +34,6 @@ void watchGlobal()
|
|||
|
||||
#endif
|
||||
|
||||
// utility functions (not required but often useful)
|
||||
int popstring(char *str)
|
||||
{
|
||||
stack_t *th;
|
||||
if (!g_stacktop || !*g_stacktop) return 1;
|
||||
th=(*g_stacktop);
|
||||
lstrcpy(str,th->text);
|
||||
*g_stacktop = th->next;
|
||||
dbgGlobalFree((HGLOBAL)th);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pushstring(char *str)
|
||||
{
|
||||
stack_t *th;
|
||||
if (!g_stacktop) return;
|
||||
th=(stack_t*)dbgGlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize);
|
||||
lstrcpyn(th->text,str,g_stringsize);
|
||||
th->next=*g_stacktop;
|
||||
*g_stacktop=th;
|
||||
}
|
||||
|
||||
char *getuservariable(int varnum)
|
||||
{
|
||||
if (varnum < 0 || varnum >= __INST_LAST) return NULL;
|
||||
return g_variables+varnum*g_stringsize;
|
||||
}
|
||||
|
||||
void setuservariable(int varnum, char *var)
|
||||
{
|
||||
if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
|
||||
lstrcpy(g_variables + varnum*g_stringsize, var);
|
||||
}
|
||||
|
||||
char *AllocString()
|
||||
{
|
||||
return (char*) dbgGlobalAlloc(GPTR,g_stringsize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue