Post by Robert on Sept 15, 2023 11:40:57 GMT -5
Currently, when a macro such as MYMAC.MACRO is issued, the macro is searched for in the standard MACROS folder. As the Macro Help states,
"For most users, the full path of this folder will be:
C:\Users\username\My Documents\SPFLite\MACROS"
This approach has proven to be workable and adequate for most purposes, but it has a few limitations.
* The current design treats the Macros folder as essentially global. It is THE macros folder.
* The current support for Instances does not specifically allow the Macros folder to be unique.
* The design does not account for application-specific Macro folders. You can only alter the Macro folder location indirectly by changing the location of the Data Storage Folder in the Config options tab.
The idea I am presenting here is an effort to address these issues. Because this could end up touching a number of existing SPFLite concepts and features, I am not suggesting this is the total answer, but the starting point for a discussion.
---
Use-case scenario:
I have a need for an "application-specific Macro Library". I term this a MACLIB, using IBM MVS terminology. What is the 'need' here? I have a data folder that is critical, and it gets backed up frequently. It is also dependent on several quite important macros, which periodically get updated. I would like to be able to relocate these "application-specific" macros from the MACROS folder, and into a subfolder of my data files, so that when I back up the application data, I back up the current state of my application macros, too. Otherwise, if I significantly change my macros, but then want to restore an old version of my data that was dependent on older versions of the macros, it might not work. So, my ability to use older data is limited to recent versions of data not dependent on older versions of those macros. And, importantly, I don't want to back up my entire standard MACROS folder all the time. It has some macro files that are large (on the order of 15-20,000 lines each) which don't change much.
---
What would a MACLIB consist of?
* A MACLIB has a "name" in the usual SPFLite sense.
* A MACLIB is named by a special SET symbol. Suppose I had a MACLIB called "MYMAC", and let's say it is located at a folder called "C:\DATA\MYMAC". Then, I would issue a SET command of the form,
SET MACLIB.MYMAC = "C:\DATA\MYMAC"
In that folder, you would store any application-specific thinBasic macros you wanted to reference.
---
Once you had defined and populated a MACLIB, how do the macros in it get referenced? There are a few ways this could be done.
* Suppose you simply wanted to 'relocate' where your 'global' Macros folder was. There would be a new Global Options entry for "Global MACLIB". This concept differs from what is defined in the Config options, because the Global MACLIB would (if defined) likely be different that the SPFLite Data Storage folder. The "Global MACLIB" entry would be part of the Config data which can be made unique per instance.
* Suppose you wanted to define a MACLIB that was associated with a particular file-type. Then, in the PROFILE, there would be a new Profile value called MACLIB. If defined, a Profile entry of "MACLIB name" would contain the name of a SET value corresponding to SET MACLIB.name as described above. If you were not using this feature, or wanted to disable it on the Profile, you would issue a primary command of MACLIB NONE.
* If you wanted to define a MACLIB via EFT, MACLIB would be an additional Profile setting that could be overridden as needed. Again, MACLIB NONE would be permitted on an EFT line.
---
Once you have defined and referenced a MACLIB, how does it actually get used? If there is a current MACLIB reference in effect, the thinBasic interpreter is invoked with that MACLIB as the "base" library where all macros are fetched. When SPFLite sees a "name" on a primary or line command area which is not built-in, its search for a possible macro would be directed to the current MACLIB in effect. If MACLIB NONE were in effect (directly or implied) the normal MACROS folder would be referenced.
Where you currently read in the Macros Help that macros are fetched from C:\Users\username\My Documents\SPFLite\MACROS" and all other discussions about #INCLUDE and #INCLUDEDIR referring to this base macro path, they would be 'relocated' at run time to wherever the MACLIB entry was pointing to at the moment.
---
I don't suggest that this overview takes every possible contingency into account, but I think it's a pretty good first explanation.
Comments invited.
R
"For most users, the full path of this folder will be:
C:\Users\username\My Documents\SPFLite\MACROS"
This approach has proven to be workable and adequate for most purposes, but it has a few limitations.
* The current design treats the Macros folder as essentially global. It is THE macros folder.
* The current support for Instances does not specifically allow the Macros folder to be unique.
* The design does not account for application-specific Macro folders. You can only alter the Macro folder location indirectly by changing the location of the Data Storage Folder in the Config options tab.
The idea I am presenting here is an effort to address these issues. Because this could end up touching a number of existing SPFLite concepts and features, I am not suggesting this is the total answer, but the starting point for a discussion.
---
Use-case scenario:
I have a need for an "application-specific Macro Library". I term this a MACLIB, using IBM MVS terminology. What is the 'need' here? I have a data folder that is critical, and it gets backed up frequently. It is also dependent on several quite important macros, which periodically get updated. I would like to be able to relocate these "application-specific" macros from the MACROS folder, and into a subfolder of my data files, so that when I back up the application data, I back up the current state of my application macros, too. Otherwise, if I significantly change my macros, but then want to restore an old version of my data that was dependent on older versions of the macros, it might not work. So, my ability to use older data is limited to recent versions of data not dependent on older versions of those macros. And, importantly, I don't want to back up my entire standard MACROS folder all the time. It has some macro files that are large (on the order of 15-20,000 lines each) which don't change much.
---
What would a MACLIB consist of?
* A MACLIB has a "name" in the usual SPFLite sense.
* A MACLIB is named by a special SET symbol. Suppose I had a MACLIB called "MYMAC", and let's say it is located at a folder called "C:\DATA\MYMAC". Then, I would issue a SET command of the form,
SET MACLIB.MYMAC = "C:\DATA\MYMAC"
In that folder, you would store any application-specific thinBasic macros you wanted to reference.
---
Once you had defined and populated a MACLIB, how do the macros in it get referenced? There are a few ways this could be done.
* Suppose you simply wanted to 'relocate' where your 'global' Macros folder was. There would be a new Global Options entry for "Global MACLIB". This concept differs from what is defined in the Config options, because the Global MACLIB would (if defined) likely be different that the SPFLite Data Storage folder. The "Global MACLIB" entry would be part of the Config data which can be made unique per instance.
* Suppose you wanted to define a MACLIB that was associated with a particular file-type. Then, in the PROFILE, there would be a new Profile value called MACLIB. If defined, a Profile entry of "MACLIB name" would contain the name of a SET value corresponding to SET MACLIB.name as described above. If you were not using this feature, or wanted to disable it on the Profile, you would issue a primary command of MACLIB NONE.
* If you wanted to define a MACLIB via EFT, MACLIB would be an additional Profile setting that could be overridden as needed. Again, MACLIB NONE would be permitted on an EFT line.
---
Once you have defined and referenced a MACLIB, how does it actually get used? If there is a current MACLIB reference in effect, the thinBasic interpreter is invoked with that MACLIB as the "base" library where all macros are fetched. When SPFLite sees a "name" on a primary or line command area which is not built-in, its search for a possible macro would be directed to the current MACLIB in effect. If MACLIB NONE were in effect (directly or implied) the normal MACROS folder would be referenced.
Where you currently read in the Macros Help that macros are fetched from C:\Users\username\My Documents\SPFLite\MACROS" and all other discussions about #INCLUDE and #INCLUDEDIR referring to this base macro path, they would be 'relocated' at run time to wherever the MACLIB entry was pointing to at the moment.
---
I don't suggest that this overview takes every possible contingency into account, but I think it's a pretty good first explanation.
Comments invited.
R