Old 10th July 2008, 01:53   #1
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Post NSISList: Simple List Plugin

Hello

I have created a very simple List plugin, namely NSISList.

Well, I know there already is NSISArray, but find it a bit complex to use.
Also coding myself makes more fun than using existing plugins

Currently only one instance (one list at a time) is supported.
And it's not documented yet, although the example should be self-explaining.

Bug reports welcome...

Edit (Afrow UK):
Attachment removed. Download from http://nsis.sourceforge.net/NSISList_plug-in#Download.
LoRd_MuldeR is offline   Reply With Quote
Old 10th July 2008, 05:23   #2
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Why do we need another plugin as there is NSISArray?
pospec is offline   Reply With Quote
Old 10th July 2008, 08:16   #3
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
As far I can say, this appears pretty different than nsis array, but even if there's not noticeable difference I prefer to have more than one options.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 10th July 2008, 13:32   #4
dbach
Member
 
Join Date: Apr 2006
Location: Somewhere in Germany
Posts: 81
@LoRd_MuldeR

Call it Alpha as long as it isn't feature complete.
dbach is offline   Reply With Quote
Old 10th July 2008, 14:11   #5
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Okay, I have added support for multiple lists. You can now create as many lists as you like. Each list is created with a (unique) name and you can use this name to access the list later. Also the missing "Insert" operation has been added, so you can insert items at a specified position now...

Edit (Afrow UK):
Attachment removed. Download from http://nsis.sourceforge.net/NSISList_plug-in#Download.
LoRd_MuldeR is offline   Reply With Quote
Old 10th July 2008, 14:35   #6
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Sorry, just found a bug in the "Insert" operation. Inserting with an improper index could cause the installer to crash! Now the index will be clipped to the bounds of the list, so inserting with an invalid index won't cause crash anymore.

See the example for details...
LoRd_MuldeR is offline   Reply With Quote
Old 10th July 2008, 15:39   #7
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
That's an absolutely interesting plugin my Lord and it's getting better as I can see.

When I'll have time, I will try to implement it with
Advanced Uninstall Log, it seems it would eliminate the disadvantage of throwing the list several times.

Nice job whatsoever

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 10th July 2008, 16:15   #8
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Thanks for your reply

1. Added "Index" command to return the index of an item
2. Added "AllRev" command to push all items onto the stack, in reverse order
3. Moved the includes to a separate file
4. Added a "Torture Test" for NSISList
LoRd_MuldeR is offline   Reply With Quote
Old 10th July 2008, 18:16   #9
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Added "Load" and "Save" to load/save a list directly from a plain text file.
See the example installer...
LoRd_MuldeR is offline   Reply With Quote
Old 10th July 2008, 21:02   #10
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Right another update: I re-enabled single instance support. So if you don't want to mess around with several lists, you can simply use the "default" list now. This list is identified with an empty string "", it doesn't need to be created and it cannot be destroyed. The default list will be created implicitly when then plugin is loaded and it will be destroyed automatically when the plugin is unloaded.

See the example installer, as always...

Last edited by LoRd_MuldeR; 10th July 2008 at 22:46.
LoRd_MuldeR is offline   Reply With Quote
Old 11th July 2008, 13:56   #11
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
I think it should be feature complete now: Added "Set" (change value of existing item), "Exch" (exchange two items by their indexes) and "Move" (move item by it's index). Also some code clean-up was done. In case no major bugs are discovered, I'd call that one finished. Writing some docs now...
LoRd_MuldeR is offline   Reply With Quote
Old 11th July 2008, 14:58   #12
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
First attempt to create some docs
Attached Files
File Type: txt nsislist.txt (7.0 KB, 570 views)
LoRd_MuldeR is offline   Reply With Quote
Old 12th July 2008, 18:45   #13
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Final version has been released on the Wiki page:
http://nsis.sourceforge.net/NSISList_plug-in

Have fun

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 12th July 2008, 18:59   #14
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Nice job LoRd_MuldeR, and the docs too. Would be somehow possible to decrease the dll size?

edit: sorry, I forgot the obvious THANKS!

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 12th July 2008, 19:16   #15
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally posted by Red Wine
Would be somehow possible to decrease the dll size?
Nope. The DLL is created with Delphi and internally I use a TStringList to store all the strings. This means I need to include the "Classes" Unit, which contains the TStringList type. I tried to copy and paste the TStringList code to my own file, so I don't need to include the entire "Classes" Unit and all of it's dependencies. But TStringList is derived from TStrings which again is derived from some other Object I cannot remember now. Also a lot of other Types are involved at different locations, which I'd need to copy as well. So in the end I'd end up with a copy of "Classes" in my own file. That makes no sens and it makes the code ugly and hard to maintain. Since TStringList is very powerful and my entire plugin depends on it, I think I'll keep it the way it is. You can of course pack the plugin DLL with UPX to make it smaller. But then your installer might actually become bigger, because "packed" files compress worse...

BTW: Is there any way to overcome the 100 KB upload limit?


[EDIT]

If anybody owns a newer (or older) version of Delphi than mine, that is Delphi 7 Professional, he/she could try to compile my sources and see if that makes the DLL any bigger/smaller. Also Lazarus might be worth a try...
LoRd_MuldeR is offline   Reply With Quote
Old 12th July 2008, 19:25   #16
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Uhm, Lazarus fails at one of the NSIS API functions

Error message is "project1.lpr(61,25) Error: Illegal qualifier"

code:
function PopString(): string;
var
th: pstack_t;
begin
if integer(g_stacktop^) <> 0 then begin
th := g_stacktop^;
Result := PChar(@th.text); // <- ERROR HERE !!!
g_stacktop^ := th.next;
GlobalFree(HGLOBAL(th));
end;
end;



Any idea how I could fix this?

This is not my own code, it's from the NSIS plugin example code for Delphi...

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 12th July 2008, 19:29   #17
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Okay!
I guess you may overcome the 100 kb limit if you split your package
I'm testing the examples right now... I'd say you should change the name to Advanced List Plugin to get closer

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 12th July 2008, 19:36   #18
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
I just tinkered with the code and I actually made it compile with Lazarus. The resulting DLL was more than 1 MB in size! Either my Lazarus compiler settings are completely wrong or it creates even bigger binaries than Delphi. Also the DLL crashed with my example installer. That most probably is because I modified the API code wrongly...


Splitting a 200 KB file

I'll keep on an external mirror then

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 12th July 2008, 20:39   #19
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Removed the compiled examples from the download, now it's 61 KB in size
http://nsis.sourceforge.net/NSISList_plug-in#Download

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 16th July 2008, 11:45   #20
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
NSISList Plugin (2008-07-16)
This update adds Map support to the NSISList plugin

The map is implemented in the header file, using only native List functions.
See the "Examples\NSISList\NSISList_Map.nsi" for info!

http://nsis.sourceforge.net/NSISList_plug-in#Download

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 16th July 2008, 11:57   #21
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Just curious - why do you use Lazarus? Isn't Delphi more "windows native"?
pospec is offline   Reply With Quote
Old 16th July 2008, 12:01   #22
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally posted by pospec
Just curious - why do you use Lazarus? Isn't Delphi more "windows native"?
I don't use Lazarus

In fact I own a copy of Delphi 7 Professional and I use it for all my projects.
One problem with Delphi is, that it creates huge DLL/EXE files, compared to plain C.
Well, Delphi's standard library is really nice, but it's not "lightweight" at all.

I tried Lazarus in the hope it will produce a smaller DLL, but the opposite was the case!
It produced a file bigger than 1 MB, Delphi's DLL was only ~100 KB in size.

On the one hand, 100 KB still is pretty big for such a simple plugin!
On the other hand, we live in the Mircosoft.NET time now

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI

Last edited by LoRd_MuldeR; 16th July 2008 at 12:39.
LoRd_MuldeR is offline   Reply With Quote
Old 17th July 2008, 00:39   #23
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Okay, if I strip the Lazarus DLL then it's only 150 KB in size
Well, that's still bigger than Delphi's DLL so I'll stick to Delphi for compiling!

Nevertheless the sources for Lanczos are included in the download.
Hopefully somebody can fix them to work...

Having an alternative compiler can never be wrong

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 10th December 2008, 09:53   #24
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Hi LoRd_MuldeR again!

Map implemetation is nice. However, I'd like to have more functions (simillar to List object - e.g. Count, First, Last and so on).

Do you think that you'll add these functionalities or should I DIY?
pospec is offline   Reply With Quote
Old 10th December 2008, 11:06   #25
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Another question - documentation reads following:
${List.Unload} (...) This function will unload the NSISList plugin, destroy ALL lists including all of their items and release all memory used by NSISList.

Do I have to call List.Destroy then? It seems that calling List.Unload once for an instance is enough.
pospec is offline   Reply With Quote
Old 27th May 2009, 14:33   #26
mattm591
Guest
 
Posts: n/a
Thanks for this plugin, the map support is very useful.

I just have a couple of queries/requests.

Firstly, is there a way I can get this plugin to send error messages to a variable instead of displaying a message box.

Secondly, is there a way I can test to see if a map is already created. I create one in a function that needs to be available in other functions, but if a page is returned to it tries to recreate the map which causes an error box to appear.

If there is a way to do the first thing I guess that would solve the second thing as I could just check the error message after calling create.
  Reply With Quote
Old 28th May 2009, 18:08   #27
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally posted by pospec
Hi LoRd_MuldeR again!

Map implemetation is nice. However, I'd like to have more functions (simillar to List object - e.g. Count, First, Last and so on).

Do you think that you'll add these functionalities or should I DIY?
A map is an unordered data structure. Elements are referenced via their keys. There is no "first" or "last" element.
Internally a map consists of two (ordered) lists, but you should not rely on that (internal) implementation!

Quote:
Originally posted by pospec
Another question - documentation reads following:
${List.Unload} (...) This function will unload the NSISList plugin, destroy ALL lists including all of their items and release all memory used by NSISList.

Do I have to call List.Destroy then? It seems that calling List.Unload once for an instance is enough.
Calling it once is sufficient. ALL your lists (and maps) will be gone.


Quote:
Originally posted by mattm591
Thanks for this plugin, the map support is very useful.

I just have a couple of queries/requests.

Firstly, is there a way I can get this plugin to send error messages to a variable instead of displaying a message box.
This is not implemented. But when using the Plugin properly, you should not encounter any error messages.
The error messages are intended to indicate serious problems to NSIS developers...

Quote:
Originally posted by mattm591
Thanks for this plugin, the map support is very useful.

Secondly, is there a way I can test to see if a map is already created. I create one in a function that needs to be available in other functions, but if a page is returned to it tries to recreate the map which causes an error box to appear.

If there is a way to do the first thing I guess that would solve the second thing as I could just check the error message after calling create.
No you can't. Make sure you create the map only once!

For example use the .onInit function to create all lists/maps that are referenced on the global scope.
You can also use a global var to check whether the map was already created...

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 20th March 2013, 09:25   #28
valentin.istrate
Junior Member
 
Join Date: Mar 2013
Posts: 3
NSISList Unicode

Hello,

I created a new NSISList DLL which works with NSIS Unicode. I needed NSISList it for one of my projects but I saw that it doesn't work with Unicode strings.

The attachment contains the source code and DLL. The project is compiled using Delphi 2007 Professional. I didn't change the Lazarus sources.
Attached Files
File Type: zip NSISList-Unicode.zip (63.2 KB, 151 views)
valentin.istrate is offline   Reply With Quote
Old 20th March 2013, 10:18   #29
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Thanks for sharing! Could you add it to the wiki page, too?
MSG is offline   Reply With Quote
Old 20th March 2013, 10:25   #30
valentin.istrate
Junior Member
 
Join Date: Mar 2013
Posts: 3
If LoRd_MuldeR agrees, I will do that. I'm waiting for a PM reply
valentin.istrate is offline   Reply With Quote
Old 20th March 2013, 11:49   #31
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
The wiki is for everyone, please add it. As long as you don't claim credit for the original work, there's no reason not to.
MSG is offline   Reply With Quote
Old 20th March 2013, 14:07   #32
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally Posted by valentin.istrate View Post
If LoRd_MuldeR agrees, I will do that. I'm waiting for a PM reply
Sure. Thanks for making a Unicode version!

I could not make a Unicode version, because I only own a license for Delphi 7.0, which is a lost case for Unicode support (yeah, there is a WideString type, but almost all VCL classes don't support it, so you'd have to re-write the complete VCL).

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 11th May 2020, 09:13   #33
Yu_Jin
Junior Member
 
Join Date: May 2020
Posts: 1
Hi, I just came across a bug in unicode build (works in ansi build)

code:

name "test"
OutFile "test.exe"
!include NSISList.nsh
Unicode true

Section
${List.Create} a
${List.Append} a "t,v,c"
${List.Debug}
SectionEnd



It says: Exception InvalidPointer in module NSISList.dll at 00015D9F.
Yu_Jin is offline   Reply With Quote
Old 11th May 2020, 09:50   #34
valentin.istrate
Junior Member
 
Join Date: Mar 2013
Posts: 3
I'll try to reproduce this issue and get back to you as soon as possible.
valentin.istrate is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump