Calling all cyberentomologists....

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#2
This is not a bug report, rather, a wish list.
1/ do not use _WC - in many countries "WC" refers to a public toilet ("water closet")
2/ some of the features are not text related, e.g. loadarray/savearray, @inivalue. They should be in a different plugin.
3/ it would be nice for @inivalue[] to be accompanied with an internal variable, set to a code reflecting the line number in the file for success, or for one of the error conditions "no file", "file not accessible", "no section", "no entry"...
4/ @inivalue needs a matching function to update .INI files. Such a function should be able to accept an empty "section" as "before the first section header" just as @inivalue, be able to delete or modify an existing line, or insert a new line at any specific location - including "before the first occurrence of section/enty" or "after the last occurrence of section/entry".
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,383
39
Albuquerque, NM
prospero.unm.edu
#3
1/ do not use _WC - in many countries "WC" refers to a public toilet ("water closet")
I know; you can use that variable in loo of the Unix utility.

2/ some of the features are not text related, e.g. loadarray/savearray, @inivalue. They should be in a different plugin.
They have more in common that you realize; most of them share a lot of the same underlying functions. I could break them out into different plugins, but they'd get correspondingly bigger. Or I could rename the plugin to "Memory-mapped OEM/UTF-16LE/UTF-16BE/UTF-8 text file utilities" -- more accurate, but not as catchy.

3/ it would be nice for @inivalue[] to be accompanied with an internal variable, set to a code reflecting the line number in the file for success, or for one of the error conditions "no file", "file not accessible", "no section", "no entry"...
Hmmm. I'll look at it; probably not too difficult.

4/ @inivalue needs a matching function to update .INI files. Such a function should be able to accept an empty "section" as "before the first section header" just as @inivalue, be able to delete or modify an existing line, or insert a new line at any specific location - including "before the first occurrence of section/enty" or "after the last occurrence of section/entry".
I agree that that would be a great feature, but at this point I don't know how to implement it! It's probably a much more complex exercise than just reading.
 
#6
Regarding the mixing of text and non-text features in a single plugin due to shared low-level routines, you could put the shared routines in a separate DLL loaded automatically when either of its callers is loaded, which would make total memory usage nearly the same as now, but this would not be consistent with the independence of each plugin, and would require installers for most anyone not a professional programmer. Possibly a different name reflecting the greater generality?

Another desired set of enhancements for SAVEARRAY and LOADARRAY would be
1/ the ability to save or load a part of the array only, specified in the manner of Fortran:
savearray [/o] myarray[3:9] myarrayfile
where the 3:9 are inclusive element offsets
2/ use another array instead of a file for saving to/loading from.

In general, it would be nice to have some array operators, similar to the matrix manipulation routines available in some HLLs.

4/ @inivalue needs a matching function to update .INI files. Such a function should be able to accept an empty "section" as "before the first section header" just as @inivalue, be able to delete or modify an existing line, or insert a new line at any specific location - including "before the first occurrence of section/enty" or "after the last occurrence of section/entry".
I agree that that would be a great feature, but at this point I don't know how to implement it! It's probably a much more complex exercise than just reading.
Undoubtedly very much more complex because it requires modification of the file. Basically it is a file editing function, which can change the middle of a file, and that cannot be done without first saving and then rewriting the rest of the file. If the file were mapped into an array, one whole line per array element, and if we had commands to copy partial arrays, this would be simple.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,383
39
Albuquerque, NM
prospero.unm.edu
#7
Another desired set of enhancements for SAVEARRAY and LOADARRAY would be
1/ the ability to save or load a part of the array only, specified in the manner of Fortran:
savearray [/o] myarray[3:9] myarrayfile
where the 3:9 are inclusive element offsets
2/ use another array instead of a file for saving to/loading from.
If you had the ability to reload partial arrays, would there really be any need to save partial arrays?

I've put up an updated build with an _INIVALUERC variable to report the completion status of the last call to @INIVALUE.
 
#8
If you had the ability to reload partial arrays, would there really be any need to save partial arrays?
Yes - if you want to save a small part of a very large array. Furthermore, my concept for saving a partial array is to save the subarray as if it were a whole array, so the using the current LOADARRAY into a new array from the file into which the subarray was saved would populate the upper left corner of the target array to the size of the saved subarray, independently from the size of the original array.
 
#9
If you had the ability to reload partial arrays, would there really be any need to save partial arrays?
Yes - if you want to save a small part of a very large array. Furthermore, my concept for saving a partial array is to save the subarray as if it were a whole array, so the using the current LOADARRAY into a new array from the file into which the subarray was saved would populate the upper left corner of the target array to the size of the saved subarray, independently from the size of the original array.