it's not finished yet, includes no test and no
documentation files.
but it works.
i just want to collect some feedback if its useful and
should be expanded somehow, or even has a chance to
make it into the stable NSIS.
it currently supports the following operations:
!if[n] val1 [= < > & | val2]
!else
!endif
where
!if val1 = val2 returns !stricmp(val1,val2)
!ifn val1 > val2 returns !(val1>val2) which is the same
as val1<=val2
its not yet possible to do
!if
!else if
!endif
attached is a cvs patch file for:
tokens.h
tokens.cpp
script.cpp
Logged In: YES
user_id=970495
updated the patch.
!if
!else if
!endif
should now work.
of course also a combination is possible:
!ifmacrondef
!else if
!else ifdef
!else
!endif
Logged In: YES
user_id=970495
forgot to mention that the patch now also includes a first
try of documentation :)
Logged In: YES
user_id=584402
The idea seems nice, I'd apply it once it's done.
Some comments:
1) !ifn is not a standard command. If already adding a
standard-ish command, I'd prefer it to act like in CPP - #if
!(something).
2) Same goes to !if false and strings in there at all.
3) Please use spaces instead of tabs in the source code.
Thanks
Logged In: YES
user_id=970495
1)you're right. but as we already have ifndef (its a
standard, i know) and ifmacrondef, i thought !ifn would be nice.
i'll change this one, but it will make things more complex.
2)what to you mean? "false" should not be handled as boolean
on boolean comparision?
3)i'll do so :) its just i prefer tabs ...
Logged In: YES
user_id=584402
#if false is invalid in CPP. It only accepts numbers or
boolean expressions. If you give it a string, you'll get an
error.
Logged In: YES
user_id=970495
updated patch.
- removed !ifn
- new syntax:
!if [!] value [op value2]
works like normal "if()" statement, if optional ! is set,
works like "if (!())".
op can be:
== and != for string comparision
<=, <, >, >= for float comparision
&& and || for boolean comparision
patch file has been updated to work with latest cvs changes
(script.cpp changes for ICON errors)
Logged In: YES
user_id=970495
updated patch.
- removed !ifn
- new syntax:
!if [!] value [op value2]
works like normal "if()" statement, if optional ! is set,
works like "if (!())".
op can be:
== and != for string comparision
<=, <, >, >= for float comparision
&& and || for boolean comparision
patch file has been updated to work with latest cvs changes
(script.cpp changes for ICON errors)
Logged In: YES
user_id=970495
uploaded documentation patch file.
Logged In: YES
user_id=970495
sry, source patch is just shit, i should test more the next
time :)
fixed (and better tested) version including a patched test
file will be up soon.
Logged In: YES
user_id=970495
uploaded new fixed patch including changes for the
preprocessor.nsi test file.
script.cpp, tokens.cpp, tokens.h, preprocessor.nsi
defines.but
Logged In: YES
user_id=970495
new documentation patch.
VERSION 2 - script.cpp, tokens.cpp, tokens.h, preprocessor.nsi, defines.but
Logged In: YES
user_id=970495
uploaded whole new patch file including docs, tests and code.
file is marked with "VERSION 2" below.
i kept the old files for the case that you like the old one
better :)
changes:
- changed == to =
- removed != operator as !if ! 1 = 2 will do the same
- changed && to & and || to |
Logged In: YES
user_id=584402
I'd prefer it to have both options of & and &&, just like
with !ifdef. Also, why remove != ? Seems useful and it's
supported by cpp.
Logged In: YES
user_id=970495
it seems unuseful for me, because as i said already:
!if ! a = b
is the same as
!if a != b
would be.
and why have multiple operators for the same thing?
you may easily add them yourselfes, no big changes ...
Logged In: YES
user_id=970495
here's a new patch
changes:
- added equivalents:
* == for =
* && for &
* || for |
- reintroduced !=
Logged In: YES
user_id=970495
last update:
- fixed documentation of new operators
(replaced VERSION 3)
VERSION 3 - script.cpp, tokens.cpp, tokens.h, preprocessor.nsi, defines.but
Logged In: YES
user_id=970495
any more wishes? :)
Logged In: YES
user_id=584402
Yes, a couple of them... Can you arrange for world peace and
weekends 4 days long?