|
From: <and...@us...> - 2021-08-26 14:49:48
|
Revision: 7305
http://sourceforge.net/p/nsis/code/7305
Author: anders_k
Date: 2021-08-26 14:49:47 +0000 (Thu, 26 Aug 2021)
Log Message:
-----------
System::Store can push/pop the flags state
Modified Paths:
--------------
NSIS/trunk/Contrib/System/Source/Buffers.c
NSIS/trunk/Contrib/System/System.html
NSIS/trunk/Docs/src/history.but
Modified: NSIS/trunk/Contrib/System/Source/Buffers.c
===================================================================
--- NSIS/trunk/Contrib/System/Source/Buffers.c 2021-08-26 12:57:34 UTC (rev 7304)
+++ NSIS/trunk/Contrib/System/Source/Buffers.c 2021-08-26 14:49:47 UTC (rev 7305)
@@ -11,7 +11,7 @@
TempStack *Next;
TCHAR Data[0];
};
-TempStack *tempstack = NULL;
+TempStack *g_tempstack = NULL;
static void AllocWorker(unsigned int mult)
{
@@ -69,10 +69,14 @@
}
PLUGINFUNCTIONEND
+#define EXECFLAGSSTACKMARKER ( sizeof(TCHAR) > 1 ? (TCHAR) 0x2691 : 0x1E ) // U+2691 Black Flag
+
PLUGINFUNCTION(Store)
{
TempStack *tmp;
+ stack_t*pNSE;
int size = ((INST_R9+1)*g_stringsize*sizeof(TCHAR));
+ int tmpint;
TCHAR *command, *cmd = command = system_popstring();
while (*cmd != 0)
@@ -83,23 +87,20 @@
case _T('S'):
// Store the whole variables range
tmp = (TempStack*) GlobalAlloc(GPTR, sizeof(TempStack)+size);
- tmp->Next = tempstack;
- tempstack = tmp;
-
// Fill with data
- copymem(tempstack->Data, g_variables, size);
+ copymem(tmp->Data, g_variables, size);
+ // Push to private stack
+ tmp->Next = g_tempstack, g_tempstack = tmp;
break;
case _T('l'):
case _T('L'):
- if (tempstack == NULL) break;
+ if (g_tempstack == NULL) break;
// Fill with data
- copymem(g_variables, tempstack->Data, size);
-
- // Restore stack
- tmp = tempstack->Next;
- GlobalFree((HANDLE) tempstack);
- tempstack = tmp;
+ copymem(g_variables, g_tempstack->Data, size);
+ // Pop from private stack
+ tmp = g_tempstack, g_tempstack = g_tempstack->Next;
+ GlobalFree((HANDLE) tmp);
break;
case _T('P'):
*cmd += 10;
@@ -111,6 +112,24 @@
case _T('r'):
GlobalFree((HANDLE) system_setuservariable(*(cmd++)-_T('0'), system_popstring()));
break;
+ case _T('f'):
+ // Pop from stack
+ pNSE = *g_stacktop, *g_stacktop = pNSE->next;
+ // Restore data
+ tmpint = extra->exec_flags->abort;
+ if (pNSE->text[0] == EXECFLAGSSTACKMARKER)
+ copymem(extra->exec_flags, pNSE->text+2, sizeof(exec_flags_t));
+ extra->exec_flags->abort = tmpint; // Don't allow overriding the abort flag
+ GlobalFree((HANDLE) pNSE);
+ break;
+ case _T('F'):
+ // Store the data
+ pNSE = (stack_t*) GlobalAlloc(GPTR, sizeof(stack_t)+(g_stringsize*sizeof(TCHAR)));
+ *((UINT32*)pNSE->text) = EXECFLAGSSTACKMARKER; // marker + '\0'
+ copymem(pNSE->text+2, extra->exec_flags, sizeof(exec_flags_t));
+ // Push to stack
+ pNSE->next = *g_stacktop, *g_stacktop = pNSE;
+ break;
}
}
Modified: NSIS/trunk/Contrib/System/System.html
===================================================================
--- NSIS/trunk/Contrib/System/System.html 2021-08-26 12:57:34 UTC (rev 7304)
+++ NSIS/trunk/Contrib/System/System.html 2021-08-26 14:49:47 UTC (rev 7305)
@@ -154,6 +154,8 @@
<li>To pop $R<i>#</i>, use R<i>#</i>, where <i>#</i> is a digit from 0 to 9.</li>
<li>To push $0-$9 and $R0-$R9 to System's private stack, use s or S.</li>
<li>To pop $0-$9 and $R0-$R9 from System's private stack, use l or L.</li>
+<li>To push the internal NSIS flags state <small>(exec_flags_t in api.h)</small> to the stack, use F.</li>
+<li>To pop the internal NSIS flags state <small>(exec_flags_t in api.h)</small> from the stack, use f.</li>
</ul>
<h4>Usage Examples</h4>
<blockquote><pre>
Modified: NSIS/trunk/Docs/src/history.but
===================================================================
--- NSIS/trunk/Docs/src/history.but 2021-08-26 12:57:34 UTC (rev 7304)
+++ NSIS/trunk/Docs/src/history.but 2021-08-26 14:49:47 UTC (rev 7305)
@@ -24,6 +24,8 @@
\b PEAddResource now supports the res:// protocol
+\b System::Store can push/pop the flags state
+
\H{v3.07} 3.07
Released on July 24th, 2021
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|