Skip to content
Jorge Zapata edited this page Aug 2, 2015 · 11 revisions

Elements

Structure elements

<lib>

The lib element defines an Ender Library. That is, the C library you want to describe.

Content: <struct>, <object>, <constant>, <def>, <function>, <method>

Attributes:

  • name: The name of the library, so for a libenesim.so, use just enesim
  • version: The version of the library, for a libenesim-1.so, use 1
  • case: What case was the library using. Possible values are: underscore for symbols like foo_bar_get, camelcase for symbols like fooBarGet, and pascal for symbols like FooBarGet

Example:

<?xml version="1.0" standalone="yes"?>
<lib name="foo" version="0" case="underscore"/>

The above XML will use the library libenesim-0.so.

Object description elements

<object>

The object element defines an Ender Object.

Content: <prop>, <function>, <method>, <ctor>, <dtor>, <ref>, <unref>

Attributes:

Example:

<struct>

The struct element defines an Ender Struct.

Content: <field>, <function>, <method>

Attributes:

Example:

<def>

The struct element defines an Ender Def.

Content:

Attributes:

Example:

Function elements

<method>

The method element defines an Ender Function that works for a particular instance of a <struct>, <object> or <def>

Content: <return>, <arg>

Attributes: Example:

<function>

The function element defines an Ender Function.

Content: <return>, <arg>

Attributes:

Example:

<ctor>

Content:

Attributes:

Example:

<dtor>

Content:

Attributes:

Example:

<ref>

Content:

Attributes:

Example:

<unref>

Content:

Attributes:

Example:

Attributes and properties elements

<prop>

Content:

Attributes:

Example:

<field>

Content:

Attributes:

Example:

<constant>

Content:

Attributes:

Example:

<?xml version="1.0" standalone="yes"?>
<lib name="foo" version="0" case="underscore">
  <!-- Define the struct -->
  <struct name="foo.s1">
    <!-- Now the fields -->
    <field name="i" type="i32"/>
    <field name="s" type="string"/>
    <!-- A method always receives the struct/object as its first argument -->
    <method name="has_i">
      <return type="i32" transfer="full"/>
    </mthod>
  </struct>
</lib>