Post by dragonjim on Feb 25, 2017 13:19:56 GMT 1
In response to comments made in this thread, I have spent some time trying to compile some basic dynamic objects that will work within a UDT, as well as making GFABasic's handling of arrays in variants a bit more flexible.
These are contained in the zipped library file (with a brief help file and example code).
Dynamic Array Library (version 1.0 Build 14) : Dynamic Arrays.zip (93.16 KB)(mirror site)
Main features (but not all):
1. A Hash table (THash) that:
- can be used in User-defined Types and Arrays, and can be passed ByRef to functions and subroutines;
- can 'remember' sort preferences and add all new keys accordingly.
2. A Dynamic Variable-length String Array (DSArray or DSA) which:
- can be used in User-defined Types and Arrays and be passed to all routines;
- can 'remember' sort preferences and add all new additions accordingly;
- has basic find, find/replace and find/remove functions.
3. A basic Variable-length String Variable that can be used in User-defined Types.
4. New commands and functions for Redim'ing and setting values in a dynamic array in a variant.
Changes in version 1.0 Build 14:
1. [New] Example.g32 added to package to give examples of how to use certain functions and commands.
2. [Bug Fix] Hash_Split was throwing an error when splitting to a 'String' THash.
3. [Bug Fix] Strings passed as values to Hash_I were being corrupted before they were added to the THash.
4. [Bug Fix] [Hash Read/DSA_Read] Stop markers were being ignored.
Changes in version 0.26 Build 13:
1. [New] DSA_Next now works in a multithreaded environment.
2. [New] Facility added to specify main or parent thread.
3. [Bug Fix] DSA_Read was not working with arrays with negative indices.
4. [Changes] Optimised error handling in multithreaded environment.
Changes in version 0.25 Build 12:
Internal optimisation changes.
Changes in version 0.24 Build 11:
1. [New] Error Handling changed to work with Multithreading.
2. [New] Universal Critical Section made available for user use.
3. [New] Thread creation, management and destruction commands and functions added.
4. [New] New clean up routine for Thread and Error handling records.
5. [Bug Fix] x2 Errors in DSA_Find caused by changes made in Build 10.
6. [Bug Fix] [Hash_] Using Hash_ to determine whether a THash has been dim'ed returns an error rather than 0 if it has not.
Changes in version 0.23 Build 10:
1. Dynamic String Arrays (DSArrays) can now how negative indicies.
2. [Bug Fix] [DSA_Read] Index not correctly set if no second parameter passed or parameter is set to DSA_RD_FROMSTART.
3. [Bug Fix] [DSA_Dim] When array redimensioned with a lower bound which is neither 0 nor 1 then lower bound was being set one too low.
4. [Bug Fix] [DSA_Arrayfill] If from% was one more than to%, no error thrown.
5. [Change] DSA_Find and DSA_Next now return -9999 instead of -1 when there is no records matching the search criteria.
Please post any bugs you might discover to this thread.
These are contained in the zipped library file (with a brief help file and example code).
Dynamic Array Library (version 1.0 Build 14) : Dynamic Arrays.zip (93.16 KB)(mirror site)
Main features (but not all):
1. A Hash table (THash) that:
- can be used in User-defined Types and Arrays, and can be passed ByRef to functions and subroutines;
- can 'remember' sort preferences and add all new keys accordingly.
2. A Dynamic Variable-length String Array (DSArray or DSA) which:
- can be used in User-defined Types and Arrays and be passed to all routines;
- can 'remember' sort preferences and add all new additions accordingly;
- has basic find, find/replace and find/remove functions.
3. A basic Variable-length String Variable that can be used in User-defined Types.
4. New commands and functions for Redim'ing and setting values in a dynamic array in a variant.
Changes in version 1.0 Build 14:
1. [New] Example.g32 added to package to give examples of how to use certain functions and commands.
2. [Bug Fix] Hash_Split was throwing an error when splitting to a 'String' THash.
3. [Bug Fix] Strings passed as values to Hash_I were being corrupted before they were added to the THash.
4. [Bug Fix] [Hash Read/DSA_Read] Stop markers were being ignored.
Changes in version 0.26 Build 13:
1. [New] DSA_Next now works in a multithreaded environment.
2. [New] Facility added to specify main or parent thread.
3. [Bug Fix] DSA_Read was not working with arrays with negative indices.
4. [Changes] Optimised error handling in multithreaded environment.
Changes in version 0.25 Build 12:
Internal optimisation changes.
Changes in version 0.24 Build 11:
1. [New] Error Handling changed to work with Multithreading.
2. [New] Universal Critical Section made available for user use.
3. [New] Thread creation, management and destruction commands and functions added.
4. [New] New clean up routine for Thread and Error handling records.
5. [Bug Fix] x2 Errors in DSA_Find caused by changes made in Build 10.
6. [Bug Fix] [Hash_] Using Hash_ to determine whether a THash has been dim'ed returns an error rather than 0 if it has not.
Changes in version 0.23 Build 10:
1. Dynamic String Arrays (DSArrays) can now how negative indicies.
2. [Bug Fix] [DSA_Read] Index not correctly set if no second parameter passed or parameter is set to DSA_RD_FROMSTART.
3. [Bug Fix] [DSA_Dim] When array redimensioned with a lower bound which is neither 0 nor 1 then lower bound was being set one too low.
4. [Bug Fix] [DSA_Arrayfill] If from% was one more than to%, no error thrown.
5. [Change] DSA_Find and DSA_Next now return -9999 instead of -1 when there is no records matching the search criteria.
Please post any bugs you might discover to this thread.