-
Notifications
You must be signed in to change notification settings - Fork 9
WIP! Attempt at changing plugin loading structure #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,12 +41,28 @@ | |
| (oll-core internal music-tools) | ||
| (lilypond-export lily) | ||
| (lilypond-export MusicXML) | ||
| (lilypond-export Humdrum) | ||
| ;(lilypond-export Humdrum) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And you still need to use the Humdrum module here, so the functions that are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @PaulMorris thank you for looking into this. Now that I see it I can't believe that I seem to have managed to miss that combination. But yet, it seems it works properly now, and I'll be able to remove the "WIP" from this PR's title ASAP (was completely away over the weekend and will need some time to catch up, though). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Glad to help @uliska . I had another thought about this. So far only the humdrum module is exporting an 'export-lilypond' function, but when musicxml does as well (and eventually MEI, etc.), will we end up with naming collisions where the api module doesn't know which 'export-lilypond' function to call? I may be missing something, but it would be worth testing this out before merging. (Which may well have been your next step!) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this is by design. Until now only the Humdrum module has been modified, and once that works I'll make all modules behave that way. Actually that's the requirement for plugging in a new exporter: providing an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I had actually read this and still was confused, and I'd say the problem at hand isn't explained in a way that I would be able to really understand it. The Guile 1.8 docs on Loading from file state that My goal would be to make it possible that a new exporter is added by only adding a new exporter file, without the need to update There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is some code: So you can collect all files in folder, import a function When my schedule allows I will prepare some code fitting into this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only have a vague idea after a first look, but there's one thing I'd definitely not want to do: produce a list of all available exporter functions. These functions are already large and will become huge when they will become more comprehensive, so we should really only load one such function. Therefore we may produce a list of available module names but the actual module loading and function parsing should occur only once. I think what I'm missing is somehow hidden in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm not mistaken this approach doesn't help either with my problem. |
||
| (lily)) | ||
|
|
||
| (re-export exportLilyPond) | ||
| (re-export exportMusicXML) | ||
| (re-export exportHumdrum) | ||
| ;(re-export exportHumdrum) | ||
|
|
||
| (define-public (load-exporter target) | ||
| (let* | ||
| ; We don't have access to os-path from a Scheme module | ||
| ((oll-core-root #{ \getOption oll-core.root #}) | ||
| (oll-root (list-head oll-core-root (- (length oll-core-root) 1))) | ||
| (here (string-join (append oll-root '("lilypond-export")) "/")) | ||
| (module-file (format "~a/~a.scm" here target))) | ||
| (ly:message "Going to load ~a\n" module-file) | ||
| (load-from-path module-file) | ||
| ; FIXME | ||
| ; I don't know why export-lilypond is not visible here. | ||
| ; In my MWE this approach worked perfectly. | ||
| ; It's clear that load-from-path does succeed | ||
| ; (because it fails if you change module-file by a character). | ||
| export-lilypond)) | ||
|
|
||
| ; create duration from moment | ||
| (define-public (moment->duration mom) | ||
|
|
@@ -467,7 +483,8 @@ | |
| (define-public scoreExporter | ||
| ; engraver to export tree in foreign format | ||
| (define-scheme-function (options)(list?) | ||
| (let* ((exporter (ly:assoc-get 'exporter options exportHumdrum #f)) | ||
| (let* ((target (ly:assoc-get 'target options 'Humdrum #f)) | ||
| (exporter (load-exporter target)) | ||
| (suffix (ly:assoc-get 'filesuffix options (object-property exporter 'file-suffix) #f)) | ||
| (filename (ly:assoc-get 'filename options | ||
| (format "~A.~A" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still need this
define-modulehere.