Re: type of location argument
Am 04.12.2013 14:58, schrieb Urs Liska: Hi, next helpless question: what Scheme type is the location argument used for Scheme functions? (write)ing location gives Hi, its: ly:input-location? HTH ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: type of location argument
Am 04.12.2013 15:00, schrieb Jan-Peter Voigt: Am 04.12.2013 14:58, schrieb Urs Liska: Hi, next helpless question: what Scheme type is the location argument used for Scheme functions? (write)ing location gives Hi, its: ly:input-location? HTH Unfortunately not (TH). This is what redirects me to Input * unsmob_input (SCM s) { if (SCM_IMP (s)) return 0; if (SCM_CAR (s) == (SCM)input_tag) // ugh. return (Input *) SCM_CDR (s); else return 0; } And that's where I get stuck. This function looks like it somehow munges a Scheme pair or list, so I tried to access it through (car location) but that didn't work. Which isn't surprising because the original (write) would have printed something like (location ...) if it were a list, isn't it? Urs ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: type of location argument
Am 04.12.2013 15:04, schrieb Urs Liska: Hi, its: ly:input-location? HTH Unfortunately not (TH). This is what redirects me to Input * unsmob_input (SCM s) { if (SCM_IMP (s)) return 0; if (SCM_CAR (s) == (SCM)input_tag) // ugh. return (Input *) SCM_CDR (s); else return 0; } And that's where I get stuck. This function looks like it somehow munges a Scheme pair or list, so I tried to access it through (car location) but that didn't work. Which isn't surprising because the original (write) would have printed something like (location ...) if it were a list, isn't it? What are you trying to do? If you want to pass a location to a music(scheme/void)-function, it looks like: %%% \version 2.17.96 % save the current location saveLocation = #(define-void-function (parser location name)(symbol?) (ly:parser-define! parser name location)) % show the file path of the given location showFile = #(define-void-function (parser location loc)(ly:input-location?) (ly:message file '~A' (car (ly:input-file-line-char-column location % save location \saveLocation hier % show file name \showFile \hier %%% The showFile function takes a ly:input-location as argument. Or is it something else, you are going to do? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: type of location argument
Urs Liska u...@openlilylib.org writes: Am 04.12.2013 15:00, schrieb Jan-Peter Voigt: Am 04.12.2013 14:58, schrieb Urs Liska: Hi, next helpless question: what Scheme type is the location argument used for Scheme functions? (write)ing location gives Hi, its: ly:input-location? HTH Unfortunately not (TH). Wanna bet? This is what redirects me to Input * unsmob_input (SCM s) { if (SCM_IMP (s)) return 0; if (SCM_CAR (s) == (SCM)input_tag) // ugh. return (Input *) SCM_CDR (s); else return 0; } And that's where I get stuck. This function looks like it somehow munges a Scheme pair or list, so I tried to access it through (car location) but that didn't work. Oh, that's bloody entrails you are dealing with here, the raw C++ code used for implementing a Scheme type. You don't want to go there. Not even the C++ code wants to go there more than once. Which isn't surprising because the original (write) would have printed something like (location ...) if it were a list, isn't it? #... basically means Uh, I have no way of printing this primitive type in a way that could be read back in, but here is some information anyway. The naming consistency for input locations and their related Scheme and C++ types and print results is actually screwed up much more than any other type I can think of. It was probably implemented before Jan and Han-Wen figured out how to do things systematically. You won't learn anything useful from _this_ code. What are you trying to achieve? -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: type of location argument
Am 04.12.2013 16:34, schrieb David Kastrup: Urs Liska u...@openlilylib.org writes: Am 04.12.2013 15:00, schrieb Jan-Peter Voigt: Am 04.12.2013 14:58, schrieb Urs Liska: Hi, next helpless question: what Scheme type is the location argument used for Scheme functions? (write)ing location gives Hi, its: ly:input-location? HTH Unfortunately not (TH). Wanna bet? This is what redirects me to Input * unsmob_input (SCM s) { if (SCM_IMP (s)) return 0; if (SCM_CAR (s) == (SCM)input_tag) // ugh. return (Input *) SCM_CDR (s); else return 0; } And that's where I get stuck. This function looks like it somehow munges a Scheme pair or list, so I tried to access it through (car location) but that didn't work. Oh, that's bloody entrails you are dealing with here, the raw C++ code used for implementing a Scheme type. You don't want to go there. Not even the C++ code wants to go there more than once. Which isn't surprising because the original (write) would have printed something like (location ...) if it were a list, isn't it? #... basically means Uh, I have no way of printing this primitive type in a way that could be read back in, but here is some information anyway. The naming consistency for input locations and their related Scheme and C++ types and print results is actually screwed up much more than any other type I can think of. It was probably implemented before Jan and Han-Wen figured out how to do things systematically. You won't learn anything useful from _this_ code. What are you trying to achieve? I want to write a function \annotate that (among other things) does - use the location to write out annotation lists to auxiliary files, for this I need the separate parts of the location - print a message to the console like ly:input-message, but without quoting what is in the input file at the location. I'm quite sure Jan-Peter's answer will keep me going (until the next obstacle arrives ...) Thanks Urs ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: type of location argument
Am 04.12.2013 16:33, schrieb Jan-Peter Voigt: Am 04.12.2013 15:04, schrieb Urs Liska: Hi, its: ly:input-location? HTH Unfortunately not (TH). This is what redirects me to Input * unsmob_input (SCM s) { if (SCM_IMP (s)) return 0; if (SCM_CAR (s) == (SCM)input_tag) // ugh. return (Input *) SCM_CDR (s); else return 0; } And that's where I get stuck. This function looks like it somehow munges a Scheme pair or list, so I tried to access it through (car location) but that didn't work. Which isn't surprising because the original (write) would have printed something like (location ...) if it were a list, isn't it? What are you trying to do? If you want to pass a location to a music(scheme/void)-function, it looks like: %%% \version 2.17.96 % save the current location saveLocation = #(define-void-function (parser location name)(symbol?) (ly:parser-define! parser name location)) % show the file path of the given location showFile = #(define-void-function (parser location loc)(ly:input-location?) (ly:message file '~A' (car (ly:input-file-line-char-column location % save location \saveLocation hier % show file name \showFile \hier %%% The showFile function takes a ly:input-location as argument. Or is it something else, you are going to do? Thanks a lot. It's _nearly_ what I want to do, but I'm quite sure it will help me do it. (cdr (ly:input-file-line-char-column location)) was the thing ... Urs ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user