WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > NSISList: Simple List Plugin
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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.

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-10-2008 01:53 AM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
pospec
Senior Member

Registered: Jun 2007
From: Otrokovice, Czech Republic

Why do we need another plugin as there is NSISArray?

__________________
My new location

Quick Link | Report this post to a moderator | IP: Logged

pospec is offline Old Post 07-10-2008 05:23 AM
Click Here to See the Profile for pospec Click here to Send pospec a Private Message Visit pospec's homepage! Find more posts by pospec Add pospec to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

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

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 07-10-2008 08:16 AM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
dbach
Member

Registered: Apr 2006
From: Somewhere in Germany

@LoRd_MuldeR

Call it Alpha as long as it isn't feature complete.

__________________
With best regards,
Denis Bach

Quick Link | Report this post to a moderator | IP: Logged

dbach is offline Old Post 07-10-2008 01:32 PM
Click Here to See the Profile for dbach Click here to Send dbach a Private Message Visit dbach's homepage! Find more posts by dbach Add dbach to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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.

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-10-2008 02:11 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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...

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-10-2008 02:35 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

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

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 07-10-2008 03:39 PM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-10-2008 04:15 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

Added "Load" and "Save" to load/save a list directly from a plain text file.
See the example installer...

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-10-2008 06:16 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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 on 07-10-2008 at 10:46 PM

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-10-2008 09:02 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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...

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-11-2008 01:56 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

First attempt to create some docs

Attachment: nsislist.txt
This has been downloaded 143 time(s).

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-11-2008 02:58 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

Final version has been released on the Wiki page:
http://nsis.sourceforge.net/NSISList_plug-in

Have fun

__________________
My Plugins: NSISList | ExecTimeout | KillProc

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-12-2008 06:45 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

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

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 07-12-2008 06:59 PM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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...

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-12-2008 07:16 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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: NSISList | ExecTimeout | KillProc

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-12-2008 07:25 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
Red Wine
Forum King

Registered: Mar 2006
From: Ath. GR

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

Quick Link | Report this post to a moderator | IP: Logged

Red Wine is offline Old Post 07-12-2008 07:29 PM
Click Here to See the Profile for Red Wine Click here to Send Red Wine a Private Message Find more posts by Red Wine Add Red Wine to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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: NSISList | ExecTimeout | KillProc

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-12-2008 07:36 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

Removed the compiled examples from the download, now it's 61 KB in size
http://nsis.sourceforge.net/NSISList_plug-in#Download

__________________
My Plugins: NSISList | ExecTimeout | KillProc

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-12-2008 08:39 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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: NSISList | ExecTimeout | KillProc

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-16-2008 11:45 AM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
pospec
Senior Member

Registered: Jun 2007
From: Otrokovice, Czech Republic

Just curious - why do you use Lazarus? Isn't Delphi more "windows native"?

__________________
My new location

Quick Link | Report this post to a moderator | IP: Logged

pospec is offline Old Post 07-16-2008 11:57 AM
Click Here to See the Profile for pospec Click here to Send pospec a Private Message Visit pospec's homepage! Find more posts by pospec Add pospec to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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: NSISList | ExecTimeout | KillProc

Last edited by LoRd_MuldeR on 07-16-2008 at 12:39 PM

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-16-2008 12:01 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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: NSISList | ExecTimeout | KillProc

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 07-17-2008 12:39 AM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
pospec
Senior Member

Registered: Jun 2007
From: Otrokovice, Czech Republic

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?

__________________
My new location

Quick Link | Report this post to a moderator | IP: Logged

pospec is offline Old Post 12-10-2008 10:53 AM
Click Here to See the Profile for pospec Click here to Send pospec a Private Message Visit pospec's homepage! Find more posts by pospec Add pospec to your buddy list Edit/Delete Message Reply w/Quote
pospec
Senior Member

Registered: Jun 2007
From: Otrokovice, Czech Republic

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.

__________________
My new location

Quick Link | Report this post to a moderator | IP: Logged

pospec is offline Old Post 12-10-2008 12:06 PM
Click Here to See the Profile for pospec Click here to Send pospec a Private Message Visit pospec's homepage! Find more posts by pospec Add pospec to your buddy list Edit/Delete Message Reply w/Quote
mattm591
Junior Member

Registered: May 2009
From:

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.

Quick Link | Report this post to a moderator | IP: Logged

mattm591 is offline Old Post 05-27-2009 02:33 PM
Click Here to See the Profile for mattm591 Find more posts by mattm591 Add mattm591 to your buddy list Edit/Delete Message Reply w/Quote
LoRd_MuldeR
Senior Member

Registered: Sep 2005
From: Germany

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: NSISList | ExecTimeout | KillProc

Quick Link | Report this post to a moderator | IP: Logged

LoRd_MuldeR is offline Old Post 05-28-2009 06:08 PM
Click Here to See the Profile for LoRd_MuldeR Click here to Send LoRd_MuldeR a Private Message Click Here to Email LoRd_MuldeR Visit LoRd_MuldeR's homepage! Find more posts by LoRd_MuldeR Add LoRd_MuldeR to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 09:23 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > NSISList: Simple List Plugin
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON