MSM-Workstation 2.0 has an editor that handles several types of object, including sources. A source is a text document that is passed through MSM's macro preprocessor when it is saved, often generating an M routine. In fact, the simplest form of source contains no macros or preprocessor directives. Its textual content is identical to that of the routine generated when it is saved.
Sources are normally stored in the global ^ZMSMSRC. For more information about this global, search the online help for "ZMSMSRC". However, it is possible to configure a database (that is, a UCI) so that when a source is opened it is loaded from a Windows file, and when it is saved the file is rewritten. This facility is not fully integrated with the development environment, so it requires a few manual steps. Treat it as an undocumented 2.0 feature, except that it's now documented here!
A source-file contains lines of ASCII text separated by $C(13,10). The first line contains the digit 1. The second line contains the name of the source. The remaining lines are the text of the source. For example:
1 Test Test ;A trial external source [ 06/21/1999 11:02 PM ] W !,"This is ",$T(+0) Q
The Windows file-system is case-preserving but not case-differentiating. That is, you can save a file called Test or TEST or test and Windows will record which case-combination you used, but you can't have more than one of these in the same directory because they overwrite each other. This means that if you want to store your sources (i.e. routines) in files you can't have two routines in the same database (UCI) that differ only in case.
And though Windows will preserve the case you enter, it's all too easy to lose this information as you manipulate files. So the source-file format records the source name in the second line.
The default extension for a source is .ms, so in the example above the lines of text for source Test will be placed in a file called Test.ms
For historical reasons, certain three-character source-name extensions are converted to and from two-character file-extensions, as follows:
|Source extension (in any case-combination)||File extension||Suggested use|
Headers and Includes typically contain the #noroutine directive to prevent them from generating routines when saved. They are referenced from other sources via the #include directive. Libraries also normally contain the #noroutine directive and employ the #makelib or #updlib directives so that they generate macro libraries when saved. Other sources then use these libraries via the #library directive.
To make Workstation's editor load and save sources from and to files, set the following node in your database (UCI):
where fullpath is the full path (including the final '\') to the directory where you want to store this database's source-files. For example:
Now Workstation knows where to load sources from, and where to save them. But in order to make the sources appear in the System Browser or the File-Open dialog you still need entries in ^ZMSMSRC. For example, to enable loading of the example file Test.ms you must set the following node:
Now a source named Test will appear in lists and can be opened in the editor. When you save it, the source will be placed into the ^ZMSMSRC global as well as into the file. But when you load it only the file is read.