Reference/!define: Difference between revisions
(Created page with "=!define = [/ifndef | /redef] ([/date|/utcdate] gflag [value]) | (/math gflag val1 OP val2) | (/file gflag filename.txt) This command will add gflag to the global define li...") |
(→!define: <code> formating, wiki links) |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
[/ifndef | /redef] ([/date|/utcdate] gflag [value]) | (/math gflag val1 OP val2) | (/file gflag filename.txt) | [/ifndef | /redef] ([/date|/utcdate] gflag [value]) | (/math gflag val1 OP val2) | (/file gflag filename.txt) | ||
This command will add gflag to the global define list. This will have a similar effect as using the /D switch on the command line (the define only becomes effective after the !define command). | This command will add <code>gflag</code> to the global define list. This will have a similar effect as using the /D switch on the command line (the define only becomes effective after the <code>!define</code> command). | ||
If /date or /utcdate are used, value will be passed into strftime and the result will be used as the value of gflag. strftime converts special symbols into certain parts of the current time or date. For example, %H will be converted into the current hour in 24-hour format. For a complete list of available symbols, | If <code>/date</code> or <code>/utcdate</code> are used, value will be passed into strftime and the result will be used as the value of gflag. strftime converts special symbols into certain parts of the current time or date. For example, <code>%H</code> will be converted into the current hour in 24-hour format. For a complete list of available symbols, see MSDN strftime function rules below. On POSIX, you can get the list by using man strftime. | ||
If /math is used, the result of | If <code>/math</code> is used, the result of <code>val1 OP val2</code>, where <code>OP</code> may be <code>+</code>, <code>-</code>, <code>*</code>, <code>&</code>, <code>|</code>, <code>^</code>, <code>/</code> or <code>%</code>, will be used as the value of <code>gflag</code>. Note that <code>val1</code> AND <code>val2</code> MUST be integer values! | ||
If /file is used, the entire text file specified (including whitespace and newlines) will be read and stuffed into gflag. | If <code>/file</code> is used, the entire text file specified (including whitespace and newlines) will be read and stuffed into <code>gflag</code>. | ||
<highlight-nsis>!define USE_SOMETHING | <highlight-nsis>!define USE_SOMETHING | ||
Line 18: | Line 18: | ||
!define /file BUNCHASTUFF somesourcefile.cpp | !define /file BUNCHASTUFF somesourcefile.cpp | ||
!define /redef USE_SOMETHING ${RESULT} ;redefine USE_SOMETHING</highlight-nsis> | !define /redef USE_SOMETHING ${RESULT} ;redefine USE_SOMETHING</highlight-nsis> | ||
== strftime Format == | |||
Format a time string as per, [https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx MSDN strftime] rules. | |||
<pre> | |||
Code Description | |||
%A Full weekday name | |||
%b Abbreviated month name | |||
%B Full month name | |||
%c Date and time representation appropriate for locale | |||
%d Day of month as decimal number (01 – 31) | |||
%H Hour in 24-hour format (00 – 23) | |||
%I Hour in 12-hour format (01 – 12) | |||
%j Day of year as decimal number (001 – 366) | |||
%m Month as decimal number (01 – 12) | |||
%M Minute as decimal number (00 – 59) | |||
%p Current locale's A.M./P.M. indicator for 12-hour clock | |||
%S Second as decimal number (00 – 59) | |||
%U Week of year as decimal number, with Sunday as first day of week (00 – 53) | |||
%w Weekday as decimal number (0 – 6; Sunday is 0) | |||
%W Week of year as decimal number, with Monday as first day of week (00 – 53) | |||
%x Date representation for current locale | |||
%X Time representation for current locale | |||
%y Year without century, as decimal number (00 – 99) | |||
%Y Year with century, as decimal number | |||
%z, %Z | |||
Either the time-zone name or time zone abbreviation, depending | |||
on registry settings; no characters if time zone is unknown | |||
%% Percent sign | |||
</pre> |
Latest revision as of 11:51, 11 December 2017
!define
[/ifndef | /redef] ([/date|/utcdate] gflag [value]) | (/math gflag val1 OP val2) | (/file gflag filename.txt)
This command will add gflag
to the global define list. This will have a similar effect as using the /D switch on the command line (the define only becomes effective after the !define
command).
If /date
or /utcdate
are used, value will be passed into strftime and the result will be used as the value of gflag. strftime converts special symbols into certain parts of the current time or date. For example, %H
will be converted into the current hour in 24-hour format. For a complete list of available symbols, see MSDN strftime function rules below. On POSIX, you can get the list by using man strftime.
If /math
is used, the result of val1 OP val2
, where OP
may be +
, -
, *
, &
, |
, ^
, /
or %
, will be used as the value of gflag
. Note that val1
AND val2
MUST be integer values!
If /file
is used, the entire text file specified (including whitespace and newlines) will be read and stuffed into gflag
.
!define USE_SOMETHING !define VERSION 1.2 !define /date NOW "%H:%M:%S %d %b, %Y" !define /math RESULT 3 + 10 !define /math REST 15 % ${RESULT} !define /file BUNCHASTUFF somesourcefile.cpp !define /redef USE_SOMETHING ${RESULT} ;redefine USE_SOMETHING
strftime Format
Format a time string as per, MSDN strftime rules.
Code Description %A Full weekday name %b Abbreviated month name %B Full month name %c Date and time representation appropriate for locale %d Day of month as decimal number (01 – 31) %H Hour in 24-hour format (00 – 23) %I Hour in 12-hour format (01 – 12) %j Day of year as decimal number (001 – 366) %m Month as decimal number (01 – 12) %M Minute as decimal number (00 – 59) %p Current locale's A.M./P.M. indicator for 12-hour clock %S Second as decimal number (00 – 59) %U Week of year as decimal number, with Sunday as first day of week (00 – 53) %w Weekday as decimal number (0 – 6; Sunday is 0) %W Week of year as decimal number, with Monday as first day of week (00 – 53) %x Date representation for current locale %X Time representation for current locale %y Year without century, as decimal number (00 – 99) %Y Year with century, as decimal number %z, %Z Either the time-zone name or time zone abbreviation, depending on registry settings; no characters if time zone is unknown %% Percent sign