Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#507 add C library string.h like string handling functions

open
Amir Szekely
Scripting (152)
5
2011-05-03
2011-05-02
Jim Michaels
No

something that would be very welcome is a collection of string handling functions.
at the very bare minimum, StrLen would be a nice one to have.
as large a collection as possible would be wonderful, whatever is not already handled.
if you need a list, see http://www.cplusplus.com/reference/clibrary/cstring/

Discussion

  • Amir Szekely
    Amir Szekely
    2011-05-02

    Where? In the scripting language we already have StrLen and for plug-ins you have strlen(), lstrlen() and whatever library you wish to use. Could you be more specific please?

     
  • Amir Szekely
    Amir Szekely
    2011-05-02

    • status: open --> pending
     
  • Jim Michaels
    Jim Michaels
    2011-05-03

    • status: pending --> open
     
  • Jim Michaels
    Jim Michaels
    2011-05-03

    so where is it documented? I can't find the documentation. that's the biggest problem with NSIS. NSIS is broken up into 1000 little libraries all over the net.
    I say, merge all the docs and files into one big installer and release that. If I want to find something, I will use the search button on help. I am tired of piecing together NSIS every time a new release comes out because it wipes out my NSIS include directory.
    actually, I think a lot of people wouldn't mind if more attention were paid on the documentation, so that
    1. there is a comprehensive index of functions available on the web and where to find them. right now things are scattered.
    2. it would be all indexed into one place. easy to reference. easy to program. maybe it's hard for NSIS developers, but the emphasis is supposed to be ease for the NSIS users, isn't it? User-friendly isn't a bad word.
    3. categorized tree-structured access to the items in the help system and on the web. for the web, use a breadcrumb menu system. an example of one can be found in O'Reilly's CSS Cookbook. tree access makes finding things fast, if it's organized well. I usually know basically I want. sometimes I know exactly what I want, so instead of using the tree I go straight to the index. I may also be nicely surprised by some new details, so links to "related" functions are helpful.
    4. I want to know what header file I need to include to get whatever function has such and such, or be able to click on a link to get the web page or file/files necessary for the plugin. actually I would prefer to not have to download anything except NSIS, and I don't mind a big download - pretty much everybody has broadband.

    so I guess I should change this bug's name to "rework documentation for comprehensiveness" because that is what this issue is turning into.
    you are saying I need to look up some functions that are already there.

    I am saying I know nothing about it and I can't find it, which is the most common problem with NSIS users I see over and over again.
    I will bet you take 70-90% of your bug reports on issues like this alone. I am saying that NSIS developers need to regroup and spend some major quality time on the docs and hold off on everything else for a while, making some sort of good reference system. after that re-release, and I think a lot of your bug reports will fade away (if you do this right).

    HOW THINGS STAND NOW:
    - right now, the wiki as it stands, HAS NO NAVIGATION. I have to use google to find something. and if I don't know exactly what I am looking for, I am out of luck. I suppose that this may be that if there are 700 pages, the navigation alone in LI+A tags would produce 120KB worth of links. it did on my site, so I had to find a different navigation system. I organized it. and I broke it down into groups. you could break the web site and docs down into things like "string handling", "processes manipulation", etc. the menu system was the same one dmoz.org and yahoo uses, a breadcrumb menu system. see my site http://JesusnJim.com and browse around for a sample of a breadcrumb menu system. I have about 700 pages, and the pages load really fast. I also have a menu management system I use to upload the pages that stores the menu structure in an XML file locally and generates the menus and ftp's the files to the server. it could be adapted to work with your setup. it's in PHP and it runs from the commandline on windows. this package is at http://JesusnJim.com/code/php/menu.html and I am just about to re-release it if I have not already.

    - the examples in the documentation are not always helpful/useful or explanatory of how to use the function. The PHP language's enhanced .chm and web documentation uses a really good method for making documentation: code snippets can be contributed to the documentation and appended to a long list in a "grey" section, whereas the rest of the documentation is a white background. and so many of the examples people contribute are most excellent and quite varied and apply to many disciplines, so you are sure to find something you need. maybe they are chosen or something I don't know how they are contributed. maybe each function page is a wiki.
    A good example can save you a large number of bug reports and tech support and man hours all around.

    - the examples that come with NSIS are so simple that they are entirely useless for showing how to develop a real, solid application that changes often (so you should use !defines for things like the program title, program name, version numbers, and some dependencies like the java executables and .net executables that need to be installed), and have .net detection, java version detection, x64 handling, windows version detection and handling for installing the .net versions, and GOOD code for shortcuts that includes a default directory, MUI2, and a license, proper language handling, and section groups. in other words, something real-world and useful.

     
  • Anders
    Anders
    2011-05-03

    All "native" makensis/nsis instructions are documented in the .chm and the online docs @ http://nsis.sourceforge.net/Docs/

    Official addons (plugins and MUI) are under \NSIS\Docs\

    3rd party stuff is documented on the wiki and in their zip files usually.

    To find the the string docs, open the .chm, switch to the index tab, type "str", I don't understand how you think this is hard...

     
  • Jim Michaels
    Jim Michaels
    2011-05-04

    the way you worded your statement earlier it sounded like a kernel32.dll function call.

    and I did switch subjects. I might as well post that block in a separate bug, because obviously I didn't get anywhere and that's not proper protocol anyway (to add another subject) in the QA field.

    yes, I see them, I have seen them (forgot about strlen)
    how about a function like strpos? that would be most useful, and there are a number of parameters you can apply to it:
    - case insensitive using the user's locale, case insensitive using ascii, case sensitive
    - occurrence number
    - start position (is this 0 or 1-based?)
    - numCharsToSearch

    this function is not in the normal string header, but it is in some other languages, and I often have to define it myself in C. in C++, the string template has 4 kinds of .find() to do this (but it's not case insensitive - bummer - need that).

    did you even look at the web page I outlined? I don't think you even took the time. added functionality here could greatly boost usability, since a lot of the work done in NSIS is done with strings - so having a good array of string functions can boost productivity.

     
  • Jim Michaels
    Jim Michaels
    2011-05-06

    ok, you seem to be losing track here, I figure you deal with a lot of bugs in one day.

    1.what about strpos? this is the kind of function I would use over and over. you bypassed this.
    2.there is a whole host of string functions that could be added here. you bypassed this issue.
    3. this is an issue I just realized not too long ago. the string functions should be broken up or copied out so that they are single-function. this eliminates a lot of confusion about what does what. strcpy is one of those all-encompassing functions that has too many uses to be comprehensible. it serves as string copy, it serves as substring, etc... If you want me to post this as a separate bug, I can.

     
  • Anders
    Anders
    2011-05-06

    Appendix E in the help file has a list of text and word helper functions.

    If you want strpos, use StrLoc in StrFunc.nsh

     
  • Jim Michaels
    Jim Michaels
    2011-05-07

    wow. there really should be an all-encompassing help category "functions/string handling"

    well, that answers *1* question. there are 2 more.
    think about it. which would you rather have? a multi-function function, or a single-purpose function?
    You seem to do a lot of resisting of everything new. I am only trying to advocate something that is best for the developer user of NSIS here. I am not just thinking of myself here.

    I was only trying to make things better.
    It seems every time I report a bug in NSIS, it has either partially or fully already been solved in the documentation. the documentation really needs to be reorganized. bug that's another bug. And I wonder how much this is try for so many other people... I would gladly trade in a new string library for better-organized+navigation documentation & libraries.