Added ${__COUNTER__} predefine
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6325 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9fa3398dd9
commit
fe8e4a36bf
3 changed files with 31 additions and 13 deletions
|
@ -177,6 +177,10 @@ Passing push will cause \R{verbose}{!verbose} to push the current verbosity leve
|
||||||
|
|
||||||
You can use these standard predefines to automatically add the build time to the title of development versions, add the date to the version number, etc.
|
You can use these standard predefines to automatically add the build time to the title of development versions, add the date to the version number, etc.
|
||||||
|
|
||||||
|
\S1{precounter} $\{__COUNTER__\}
|
||||||
|
|
||||||
|
Expands to a number (Starting at 0 and incrementing by 1 every time it is used)
|
||||||
|
|
||||||
\S1{prefile} $\{__FILE__\}
|
\S1{prefile} $\{__FILE__\}
|
||||||
|
|
||||||
Current script name.
|
Current script name.
|
||||||
|
|
|
@ -32,6 +32,8 @@ Released on ?, 2013
|
||||||
|
|
||||||
\b Added $\{NSIS_PACKEDVERSION\}, the NSIS version packed in a hex number (\W{http://sourceforge.net/support/tracker.php?aid=2680832}{patch #2680832})
|
\b Added $\{NSIS_PACKEDVERSION\}, the NSIS version packed in a hex number (\W{http://sourceforge.net/support/tracker.php?aid=2680832}{patch #2680832})
|
||||||
|
|
||||||
|
\b Added $\{__COUNTER__\} predefine
|
||||||
|
|
||||||
\b Added UnsafeStrCpy instruction, it can write to special variables like $PLUGINSDIR
|
\b Added UnsafeStrCpy instruction, it can write to special variables like $PLUGINSDIR
|
||||||
|
|
||||||
\b Plugins in $\{NSISDIR\}\\Plugins have to be reserved with \c{ReserveFile /plugin}
|
\b Plugins in $\{NSISDIR\}\\Plugins have to be reserved with \c{ReserveFile /plugin}
|
||||||
|
|
|
@ -684,21 +684,33 @@ void CEXEBuild::ps_addtoline(const TCHAR *str, GrowBuf &linedata, StringList &hi
|
||||||
ps_addtoline(s,defname,hist);
|
ps_addtoline(s,defname,hist);
|
||||||
defname.add(_T(""),sizeof(_T("")));
|
defname.add(_T(""),sizeof(_T("")));
|
||||||
t=definedlist.find((TCHAR*)defname.get());
|
t=definedlist.find((TCHAR*)defname.get());
|
||||||
TCHAR unichar[4+1];
|
TCHAR dyndefbuf[10+1];
|
||||||
if (!t && _T('U')==s[0] && _T('+')==s[1])
|
if (!t)
|
||||||
{
|
{
|
||||||
TCHAR *n=s+2;
|
if (_T('_')==s[0] && _T('_')==s[1])
|
||||||
unsigned long utf32=_tcstoul(n,&t,16);
|
|
||||||
// We only want to accept "${U+HEXDIGITS}" and not "${U+ -HEXDIGITS }"
|
|
||||||
if (*t || _T('-')==*n || _T('+')==*n) t=0;
|
|
||||||
if (_T(' ')==*n || _T('\t')==*n) t=0; // TODO: _istspace()?
|
|
||||||
if (!utf32) t=0; // Don't allow "${U+0}"
|
|
||||||
if (t)
|
|
||||||
{
|
{
|
||||||
UINT32 codpts[]={utf32,UNICODE_REPLACEMENT_CHARACTER,'?'};
|
if (!_tcscmp(s,_T("__COUNTER__")))
|
||||||
for(UINT i=0; i < COUNTOF(codpts); ++i)
|
{
|
||||||
if (WCFromCodePoint(unichar,COUNTOF(unichar),codpts[i])) break;
|
static unsigned long cntr=0;
|
||||||
t=unichar;
|
_stprintf(dyndefbuf,_T("%lu"),cntr++);
|
||||||
|
t=dyndefbuf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_T('U')==s[0] && _T('+')==s[1])
|
||||||
|
{
|
||||||
|
TCHAR *n=s+2;
|
||||||
|
unsigned long utf32=_tcstoul(n,&t,16);
|
||||||
|
// We only want to accept "${U+HEXDIGITS}" and not "${U+ -HEXDIGITS }"
|
||||||
|
if (*t || _T('-')==*n || _T('+')==*n) t=0;
|
||||||
|
if (_T(' ')==*n || _T('\t')==*n) t=0; // TODO: _istspace()?
|
||||||
|
if (!utf32) t=0; // Don't allow "${U+0}"
|
||||||
|
if (t)
|
||||||
|
{
|
||||||
|
UINT32 codpts[]={utf32,UNICODE_REPLACEMENT_CHARACTER,'?'};
|
||||||
|
for(UINT i=0; i < COUNTOF(codpts); ++i)
|
||||||
|
if (WCFromCodePoint(dyndefbuf,COUNTOF(dyndefbuf),codpts[i])) break;
|
||||||
|
t=dyndefbuf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (t && hist.find((TCHAR*)defname.get(),0)<0)
|
if (t && hist.find((TCHAR*)defname.get(),0)<0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue