lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with /accepts


From: David Kastrup
Subject: Re: Problem with /accepts
Date: Tue, 18 Apr 2017 15:45:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> 2017-04-18 10:55 GMT+02:00 David Kastrup <address@hidden>:
>> Thomas Morley <address@hidden> writes:
>>
>>> 2017-04-17 21:08 GMT+02:00 Roman Stawski <address@hidden>:
>>>> Hello all
>>>>
>>>>
>>>> I'm coming across a problem with context definitions:
>>>>
>>>>     \layout {
>>>>         \context {
>>>>             \name P
>>>>             \alias Voice
>>>>         }
>>>>
>>>> This blows up with the error
>>>>
>>>> Interpreting music...ERROR: In procedure symbol->string:
>>>>     ERROR: Wrong type argument in position 1 (expecting symbol): ()
>>>>     Exited with return code 1.
>>>>
>>>> If I comment out the '\accepts' compilation finishes, (but ignores the
>>>> context P obviously).
>>>
>>> From: NR 5.1.6 Defining new contexts
>>>
>>> "The mechanisms with which contexts communicate are established by declaring
>>> the context \type. Within a \layout block, most contexts will be of type
>>> Engraver_group.
>>> [...]
>>> Copying and modifying an existing context definition will also fill in
>>> the type."
>>>
>>>
>>> So (see comments):
>>>
>>>
>>> \layout {
>>>     %% define "P" from scratch
>>>     \context {
>>>         \type "Engraver_group"
>>>         \name P
>>>         \alias Voice
>>>         %% put in engravers for what you want
>>>         %% otherwise no output
>>>     }
>>
>> Trigger and wording of error message are not overly helpful here.  This
>> should likely be caught at an earlier point of time.
>>
>> --
>> David Kastrup
>
> Out of curiosity, could you point me to where the current error is triggered?
>
> I've added some debugging code:
>
> (define (print-book-with parser book process-procedure)
>   (let* ((paper (ly:parser-lookup parser '$defaultpaper))
>          (layout (ly:parser-lookup parser '$defaultlayout))
>          (outfile-name (get-outfile-name parser book)))
>
>   (pretty-print
>     (list
>           book
>           paper
>           (map
>                 (lambda (sym)
>                  (cons
>                   (ly:context-def-lookup
>                      (assoc-get 'P (ly:module->alist
> (ly:output-def-scope layout)))
>                      sym)
>                   sym))
>               (list
>                 'default-child
>                 'consists
>                 'description
>                 'aliases
>                 'accepts
>                 'property-ops
>                 'context-name
>                 'group-type))
>           (assoc-get 'P (ly:module->alist (ly:output-def-scope layout)))
>           outfile-name))
>
>     (process-procedure
>           book
>           paper
>           layout
>           outfile-name)))
>
> returning:
>
> (#<Book>
>  #< Output_def>
>  ((() . default-child)
>   (() . consists)
>   (() . description)
>   ((Voice) . aliases)
>   (() . accepts)
>   (() . property-ops)
>   (P . context-name)
>   (() . group-type))
>  #<Context_def P atest-55.ly:636:5>
>  "atest-55")
>
> Though, I don't see symbol->string applied anywhere there.

My guess is lily/context.cc:

void
Context::create_context_from_event (SCM sev)
{
  Stream_event *ev = unsmob<Stream_event> (sev);

  string id = ly_scm2string (ev->get_property ("id"));
  SCM ops = ev->get_property ("ops");
  SCM type_scm = ev->get_property ("type");
  string type = ly_symbol2string (type_scm);

It's probably the last line quoted that gives this error.  The "accepts"
stuff is likely a red herring: if a context is not acceptable, it won't
get created in the first place and thus not trigger the error.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]