4-11. MUSTIG Libraries

4-11-1. Dynamic load process
Principle
Compelling MUSTIG to save the internal content of all the macros
4-11-2. Virtual reading of the libraries
4-11-3. Creating a custom library
4-11-4. Protecting a macro with a password

 

4-11-1. Dynamic load process

Principle

When a macro or a module (the frequently used View/t macro for instance) is dragged from the MUSTIG Library and dropped into the program window, its internal structure is copied into memory when the user carries out a simulation that requires this module. However, it is not necessary to save this structure in the .MTG program file, for the macro is fully described in the Library.

This is exactly what MUSTIG does : macros taken from the Library and left unchanged by the user are saved only as references.

If a macro taken from the Library is modified by the user, the portion of the internal structure that has been changed is saved into the .MTG file.

To know whether a macro will be fully saved, or saved only as a library reference, just open the macro. Macros from the Library are drawn in a window with slightly thinner borders. Modified macros are displayed with thicker borders featuring a thin, black sub-frame.

Compelling MUSTIG to save the internal content of all the macros

You may however compel MUSTIG to save the internal content of ALL the macros by selecting the Save whole graph option in the Edit / Options menu. This may be useful if you have used macros from a custom library, and you want to use your application on a computer where this library is not present. However, be aware that the size of the obtained file may be huge.

4-11-2. Virtual reading of the libraries

Only the visible parts of a library plus the elements used by the current program, are loaded into memory. This allows to save a large amount of RAM (Read Only Memory) and makes it possible to load several libraries at a time, without overflowing the memory.

Another consequence is that the libraries are read much faster (except when a library is read for the first time : in this case MUSTIG must create a special .bib file).

The same mechanism is used for reading MUSTIG programs: the elements of the graph are loaded only as and when required, that is, when a macro is opened or when the user launches a simulation.

4-11-3. Creating a custom library

Suppose you have built several macros in MUSTIG language, and you want to be able to re-use these custom macros frequently in order to create other applications.

  1. Put all these macros into a single MUSTIG program and arrange them to taste. You may gather several macros together inside a first-level macro to create "directories", like the Custom viewing macros box in the example below :
  2. Make sure every box is documented : undocumented macros cannot be used as library elements to which other programs can refer. To document a macro, just click on it to select it and hit the Alt+U shortcut. Then enter the Edit mode in the online help window by pressing Shift+Ctrl+Click, and enter the online help text (see Documenting a macro).
  3. Select the program and run the Save special command in the File menu : your file is saved in a special format.

When you reopen it using the classical File / Open command, it is read as a library : when you slide a macro from this new library into a program window, only its reference is saved in the file (see Dynamic load process).

Later on, if you open a program that requires one or several macros from this new library, the latter will open automatically. MUSTIG will first search for it in the current directory, then in all the directories entered in the Edit / Options / Paths window.

4-11-4. Protecting a macro with a password

MUSTIG allows to protect any macro with a password. To set a password for a macro, just click on it to select it and select the Protect with password command in the Tools menu. Click on "OK" to terminate.

The user will be asked to enter the password each time he double-clicks on the macro to open it. If a wrong password is entered, the macro does not open.

This mechanism allows you to create custom libraries that cannot by opened or modified by the users.

 

To remove the password, open the macro with the correct password, then click on the macro, select Protect with password again, and enter a carriage return as a password.