- NSIS Discussion
- Stack plugin
Archive: Stack plugin
Instructor
28th July 2005 23:44 UTC
Stack plugin
Last few days I'm wrote header on "C" with linear (one direction) and bilinear (two directions) stack functions. I has thought if make NSIS plugin that probably will be useful for somebody.
Functions for working with NSIS stack (linear):
ns_push_front (same as Push)
ns_pop_front (same as Pop)
ns_push_back
ns_stack_read
ns_stack_write
ns_stack_size
ns_stack_free
Functions for working with private stack (bilinear):
dll_push_front
dll_pop_front
dll_push_back
dll_pop_back
dll_stack_read
dll_stack_write
dll_stack_insert
dll_stack_delete
dll_stack_size
dll_stack_free
Joel
29th July 2005 04:24 UTC
Cool :up:
I can share with you my NOT crt function of lstrcmp since once I also use it :tinfoil:
int_stdcall_strcmp
(char*s1,char*s2)
{
for(;*s1&&*s2;++s1,++s2)
{
if(*s1!=*s2)
{
break;
}
}
return*s1-*s2;
}
Instructor
29th July 2005 09:56 UTC
If you talk about lstrcmp, probably the correct variant will be:
int__stdcall_strcmp
(char*s1,char*s2)
{
for(;(*s1)&&(*s2);++s1,++s2)
if(*s1<*s2)
return-1;
elseif(*s1>*s2)
return1;
if((!*s1)&&(!*s2))
return0;
elseif(!*s1)
return-1;
else
return1;
}
kichik
29th July 2005 11:51 UTC
lstrcmp is not part of CRT. You're confusing it with strcmp. lstrcmp is a Windows API, defined in kernel32.dll. There's no need to write a replacement for it.
Instructor
10th August 2005 08:49 UTC
Changes:
- New: Supports multi-stack (StackFunc.h).
- Fixed: xitoa string missing terminating null character when number is "0" (ConvFunc.h).
Functions for working with NSIS stack (linear):
- ns_stack_free->ns_stack_clear (function now not uses pop_frontL)
Functions for working with private stack (bilinear):
- Changed: stack_insert now can insert element to the top and first places
- dll_stack_free->dll_stack_clear (function now not uses pop_front)
- New: stack_exchange
- New: stack_delete_range
- New: stack_move
- New: stack_move_range
- New: stack_sort
- New: stack_reverse_range
Instructor
1st September 2005 12:55 UTC
Changes:
- New: stack::dll_push_sort (Pushs element to the stack and sorts alphabetically in ascending or descending)
- Added example how to sort lines in a text file
- Supports custom structures (StackFunc.h)
"Stack" plugin v1.2
Instructor
2nd March 2006 19:39 UTC
1. New:
dll_push_sort_int
dll_sort_all_int
Debug
2. Renamed:
ns_stack_read->ns_read
ns_stack_write->ns_write
ns_stack_size->ns_size
ns_stack_clear->ns_clear
dll_stack_read->dll_read
dll_stack_write->dll_write
dll_stack_insert->dll_insert
dll_stack_exchange->dll_exchange
dll_stack_reverse_range->dll_reverse_range
dll_stack_delete->dll_delete
dll_stack_delete_range->dll_delete_range
dll_stack_move->dll_move
dll_stack_move_range->dll_move_range
dll_stack_sort->dll_sort_all
dll_stack_size->dll_size
dll_stack_clear->dll_clear
Update from previous versions:
- Insert line in script:
!include "Stack.nsh"
- Replace:
stack::ns_push_front -> ${stack::ns_push_front} ...
- Replace:
.r0 -> $0, .r1 -> $1 ... .R0 -> $R0, .R1 -> $R1 ...
"Stack" plugin v1.4
Comm@nder21
3rd March 2006 15:17 UTC
nice one.
Instructor
16th May 2006 08:53 UTC
Updated: "StackFunc.h" to v1.7
Added: now possible dynamically create private stacks, all private stack functions
now require stack handle in first parameter
Removed: dll_push_front, dll_pop_front, dll_push_back, dll_pop_back, because
dll_insert and dll_delete can be used
"Stack" plugin v1.5
Instructor
17th May 2006 00:49 UTC
Updated: "StackFunc.h" to v1.8
"Stack" plugin v1.6
Instructor
27th November 2009 17:23 UTC
Updated: "StackFunc.h" to v3.0
"Stack" plugin v1.7
Marshall7a
4th January 2011 14:13 UTC
The documentation doesn't mention that you have to clear a private stack before you destroy it, otherwise memory is leaked for the elements on the stack!
Marshallx7
20th June 2013 10:10 UTC
There appears to be a memory leak in the private stacks. I just created a test script that inserts 10,000 elements, then deletes them.
Memory usage before create: 1,380KB
Memory usage after create: 1,392KB
Memory usage after 10,000 inserts: 12,432KB
Memory usage after 10,000 deletes: 2,712KB
Destroyed but not unloaded: 2,588 KB
I tried the same thing with inserting and deleting 1,000,000 elements (this took a long time to run) and the memory usage at the end was over 190 MB !
Instructor
16th September 2013 16:59 UTC
Added: full unicode support on NSIS Unicode.
Fixed: ${stack::dll_destroy} didn't erase the stack before destroying.
Stack plugin v1.8
aerDNA
17th September 2013 19:02 UTC
I've found Stack precious in several scripts, thank you. Nice to see it up to date.
Instructor
18th September 2013 19:39 UTC
Added: ${stack::ns_pop_back} - removes the element from the end of the NSIS stack and puts it in the variable.
Added: ${stack::ns_insert} - inserts new element at specified index of the NSIS stack.
Added: ${stack::ns_delete} - finds the NSIS element by index, puts it in the variable and removes it.
Stack plugin v2.0