HPInc / HP-Digital-Microfluidics

HP Digital Microfluidics Software Platform and Libraries
MIT License
2 stars 0 forks source link

Allow multiple macro files #214

Closed EvanKirshenbaum closed 5 months ago

EvanKirshenbaum commented 5 months ago

Currently, the exercisers take a --macro-file argument to specify a macro definition file to be loaded before run.

When looking at the OSU protocols, it dawned on me that it would be a good idea to allow the user to have a relatively stable library of macros to draw on while they write macros for their particular task at hand. The alternative is copying macros from file to file, which becomes a maintenance nightmare whenever any of the common macros get redefined.

So what I propose is to allow --macro-file to be provided more than once, with the file names collected into a list. This list could be passed down (as the single file name now is) until it got to DMFInterpreter, which would have to load multiple files into the same globals and namespace.

(An alternate approach would be to add the ability for one macro file to include another, but that gets into all sorts of problems related to search paths and recursive includes and the like, which I'd just as soon put off to later.)

Migrated from internal repository. Originally created by @EvanKirshenbaum on Jan 07, 2023 at 12:45 PM PST. Closed on Jan 07, 2023 at 2:55 PM PST.
EvanKirshenbaum commented 5 months ago

This issue was referenced by the following commit before migration:

EvanKirshenbaum commented 5 months ago

Just a matter of adding action='append' to the argument and propagating the change. Macro files are processed in the order they appear on the command line.

Note that there is no checking to ensure that the same file isn't specified twice (there arguably should be) and failing on one file doesn't preclude later files from being processed (it arguably should).

In this push, I also committed some additional macros in macros.dmf that have been floating around locally. They shouldn't hurt anything.

Migrated from internal repository. Originally created by @EvanKirshenbaum on Jan 07, 2023 at 2:55 PM PST.