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

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

    Attachment: Method.pm
                Function.pm

Boilerplater::Binding::Core::Function is a small module; since there is a
direct mapping between "inert" functions and C functions, the only thing it
does is generate a function declaration.

{code:none}
/* Boilerplater declaration. */
inert i32_t 
do_stuff(Foo *self, Bar *thing);

/* Autogenerated C function declaration. */
chy_i32_t
boil_Foo_do_stuff(boil_Foo *self, boil_Bar *thing);
{code}

Boilerplater::Binding::Core::Method is more involved.  It generates a
function declaration as well, but it also generates several other chunks of
code.

    * A static inline function for invoking the method via the vtable, or
      in the case of "final" methods, a pound-define aliasing the method
      invocation symbol to the name of the implementing function.
    * For "abstract" methods, a default implementation which throws a runtime
      error providing information about the missing method.  
    * For methods which may be overridden via the host, a function which
      implements the callback to the host, named e.g.
      "boil_Foo_do_stuff_OVERRIDE".
    * A "Callback" object, which stores the name of the method and a pointer
      to the OVERRIDE function.  This is used for introspection when building
      a VTable for a subclass, as we walk the host symbol table looking for
      methods which need callback wrappers installed in the vtable to invoke
      the host implementation.
    * A typedef for the method signature, named e.g. "boil_Foo_do_stuff_t",
      which is needed by the virtual method invocation when casting the
      function pointer which has been retrieved from the vtable.

> 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: 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