[ 
https://issues.apache.org/jira/browse/LUCY-28?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marvin Humphrey updated LUCY-28:
--------------------------------

    Attachment: Core.pm

Boilerplater::Binding::Core is the class which build scripts actually deal
with.  It has only a constructor and one object method: write_all_modified().

Somewhere in the Lucy hierarchy there will be a shared Perl script with an
incantation similar to this, which will need to be invoked for every host:

{code:none}
my $hierarchy = Boilerplater::Hierarchy->new(
    source => '/path/to/bp/files',
    dest   => 'autogen',
);
$hierarchy->build;
my $core_binding = Boilerplater::Binding::Core->new(
    hierarchy => $hierarchy,
    dest      => 'autogen',
    header    => "/* Auto-generated file. */\n",
    footer    => $copyfoot,
);
my $modified = $core_binding->write_all_modified($modified);
{code}

write_all_modified() also generates a "boil.h" file which is pound-included in
every header.  It contains struct typedefs for every class in the hierarchy,
plus a bunch of miscellaneous stuff:

    * The typedef and union definition for lucy_ref_t, which holds a
      pointer/refcount.
    * The typedef for lucy_method_t.
    * The METHOD macro, which retrieves a function pointer from a vtable.
    * The SUPER_METHOD macro, which retrieves a function pointer from the
      parent class's vtable.
    * The OVERRIDDEN macro, which returns a boolean indicating whether a
      method has been overridden in a VTable, or whether it inherits a pointer
      to the function that provided the novel implementation.

All of those are mild kludges and could withstand revisiting at some point.

> Boilerplater core bindings
> --------------------------
>
>                 Key: LUCY-28
>                 URL: https://issues.apache.org/jira/browse/LUCY-28
>             Project: Lucy
>          Issue Type: Sub-task
>          Components: Boilerplater
>            Reporter: Marvin Humphrey
>            Assignee: Marvin Humphrey
>         Attachments: Class.pm, Core.pm, File.pm, Function.pm, Method.pm
>
>
> A Boilerplater::Hierarchy, comprised of Classes, Methods, Variables, and so
> on, describes an abstract specification for a class hierarchy.
> Boilerplater::Binding::Core and its helpers generate C code which implements
> the spec.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to