54 lines
2.0 KiB
Plaintext
54 lines
2.0 KiB
Plaintext
|
//* Copyright 2017 The NXT Authors
|
||
|
//*
|
||
|
//* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
//* you may not use this file except in compliance with the License.
|
||
|
//* You may obtain a copy of the License at
|
||
|
//*
|
||
|
//* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
//*
|
||
|
//* Unless required by applicable law or agreed to in writing, software
|
||
|
//* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
//* See the License for the specific language governing permissions and
|
||
|
//* limitations under the License.
|
||
|
|
||
|
typedef unsigned long uint32_t;
|
||
|
|
||
|
{% macro idlType(type) -%}
|
||
|
{%- if type.category == "object" -%}
|
||
|
NXT{{type.name.CamelCase()}}
|
||
|
{%- else -%}
|
||
|
{{as_cType(type.name)}}
|
||
|
{%- endif -%}
|
||
|
{%- endmacro %}
|
||
|
|
||
|
interface {{as_idlType(type.name)}} {
|
||
|
{% if type.name.canonical_case() == "device" %}
|
||
|
{% for type in by_category["enum"] + by_category["bitmask"] %}
|
||
|
{% for value in type.values %}
|
||
|
const uint32_t {{type.name.SNAKE_CASE()}}_{{value.name.SNAKE_CASE()}} = 0x{{format(value.value, "08X")}};
|
||
|
{% endfor %}
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
|
||
|
{% for method in type.methods %}
|
||
|
{% if method.return_type.name.concatcase() == "void" %}
|
||
|
{{as_idlType(type.name)}}
|
||
|
{%- else %}
|
||
|
{{as_idlType(method.return_type.name)}}
|
||
|
{%- endif -%}
|
||
|
{{" "}}{{method.name.camelCase()}}(
|
||
|
{%- for arg in method.arguments -%}
|
||
|
{%- if not loop.first %}, {% endif -%}
|
||
|
{%- if arg.annotation == "value" -%}
|
||
|
{{as_idlType(arg.type.name)}} {{as_varName(arg.name)}}
|
||
|
{%- elif arg.annotation == "const*" and arg.length == "strlen" -%}
|
||
|
String {{as_varName(arg.name)}}
|
||
|
{%- else -%}
|
||
|
{{as_idlType(arg.type.name)}}[] {{as_varName(arg.name)}}
|
||
|
{%- endif -%}
|
||
|
{%- endfor -%}
|
||
|
);
|
||
|
{% endfor %}
|
||
|
};
|