//* 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()}} {%- elif type.category == "enum" or type.category == "bitmask" -%} uint32_t {%- else -%} {{as_cType(type.name)}} {%- endif -%} {%- endmacro %} interface {{idlType(type)}} { {% 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" %} {{idlType(type)}} {%- else %} {{idlType(method.return_type)}} {%- endif -%} {{" "}}{{method.name.camelCase()}}( {%- for arg in method.arguments -%} {%- if not loop.first %}, {% endif -%} {%- if arg.annotation == "value" -%} {{idlType(arg.type)}} {{as_varName(arg.name)}} {%- elif arg.annotation == "const*" and arg.length == "strlen" -%} DOMString {{as_varName(arg.name)}} {%- else -%} {{idlType(arg.type)}}[] {{as_varName(arg.name)}} {%- endif -%} {%- endfor -%} ); {% endfor %} };