lilypond-auto
[Top][All Lists]
Advanced

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

Re: [Lilypond-auto] Issue 4462 in lilypond: Create a module variable acc


From: lilypond
Subject: Re: [Lilypond-auto] Issue 4462 in lilypond: Create a module variable access system for C++
Date: Thu, 02 Jul 2015 10:56:45 +0000

Updates:
        Status: Fixed
        Labels: -Patch-push Fixed_2_19_23

Comment #8 on issue 4462 by address@hidden: Create a module variable access system for C++
https://code.google.com/p/lilypond/issues/detail?id=4462

Pushed to staging as
commit 91649a0ead8af565c5e0406601ee71c8cda57a57
Author: David Kastrup <address@hidden>
Date:   Fri Jun 26 11:39:54 2015 +0200

    Issue 4462/2: For Scm_module::import, only look at exported variables

commit 652f454fae6ed31ced7f9c3ce22dbc5752460a8c
Author: David Kastrup <address@hidden>
Date:   Thu Jun 25 13:04:50 2015 +0200

    Issue 4462/1: Create a module variable access system for C++

    This replaces the previous "memoizing" ly_lily_module_constant with a
    rather rigid system for importing/exporting/accessing module variables.

    As opposed to the system used by ly_lily_module_constant, access will
    continue to go through the respective module variables, making it
    possible to also write to the respective variables.  In addition, this
    ensures that any changes to the variables from the Scheme side will get
    properly reflected in the C++ side, allowing for redefinitions when
    debugging.

    In a nutshell, ly_lily_module_constant ("ly:music?") would generally be
    replaced with Lily::ly_music_p, a declaration of it looking like

      extern Variable ly_music_p;

    would be placed in namespace Lily in lily/include/lily-imports.hh, and a
    corresponding definition

      Variable ly_music_p ("ly:music?");

    in namespace Lily in lily/lily-imports.cc .  The type Scm_module where
    variables are organized can use pre-existing modules (in which case it
    is initialized by calling the member function import ()) or are can
    bring up a fresh module (in which case it is initialized by calling the
    member function boot ()).  The startup is done in lily/guile-init.cc .

    Since one of the most frequent uses of imported variables is for
    function calls, the Scm_variable type (underlying the module-local
    Variable type) has operator () defined to allow calling as a function.

    So the previous

        scm_call_1 (ly_lily_module_constant ("ly:music?"), x);

    can now be expressed as

        Lily::ly_music_p (x);


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings



reply via email to

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