mirror of https://github.com/bkaradzic/bgfx
Updated IDL scripts.
This commit is contained in:
parent
7d047dfc5b
commit
4a96919315
|
@ -1,9 +1,8 @@
|
|||
-- Copyright 2019 云风 https://github.com/cloudwu . All rights reserved.
|
||||
-- License (the same with bgfx) : https://github.com/bkaradzic/bgfx/blob/master/LICENSE
|
||||
|
||||
local idl = require "idl"
|
||||
local codegen = require "codegen"
|
||||
local doxygen = require "doxygen"
|
||||
local idl = codegen.idl "bgfx.idl"
|
||||
|
||||
local func_actions = {
|
||||
|
||||
|
@ -31,14 +30,6 @@ local type_actions = {
|
|||
cfuncptrs = "\n",
|
||||
}
|
||||
|
||||
do
|
||||
local source = doxygen.load "bgfx.idl"
|
||||
local f = assert(load(source, "bgfx.idl" , "t", idl))
|
||||
f()
|
||||
end
|
||||
|
||||
codegen.nameconversion(idl.types, idl.funcs)
|
||||
|
||||
local function cfunc(f)
|
||||
return function(func)
|
||||
if not func.cpponly then
|
||||
|
|
|
@ -248,7 +248,7 @@ local function calc_flag_values(flag)
|
|||
value = index + base - 1
|
||||
end
|
||||
if value >= cap then
|
||||
error (string.format("Out of range for %s (%d/%d)", name, value, cap))
|
||||
error (string.format("Out of range for %s.%s (%d/%d)", flag.name, item.name, value, cap))
|
||||
end
|
||||
value = value << shift
|
||||
elseif #item == 0 then
|
||||
|
@ -964,4 +964,31 @@ function codegen.gen_handle(handle)
|
|||
return (handle_temp:gsub("$(%u+)", { NAME = handle.name }))
|
||||
end
|
||||
|
||||
local idl = require "idl"
|
||||
local doxygen = require "doxygen"
|
||||
local conversion
|
||||
local idlfile = {}
|
||||
|
||||
function codegen.load(filename)
|
||||
assert(conversion == nil, "Don't call codegen.load() after codegen.idl()")
|
||||
assert(idlfile[filename] == nil, "Duplicate load " .. filename)
|
||||
local source = doxygen.load(filename)
|
||||
|
||||
local f = assert(load(source, filename , "t", idl))
|
||||
f()
|
||||
idlfile[filename] = true
|
||||
end
|
||||
|
||||
function codegen.idl(filename)
|
||||
if conversion == nil then
|
||||
if filename and not idlfile[filename] then
|
||||
codegen.load(filename)
|
||||
end
|
||||
assert(next(idlfile), "call codegen.load() first")
|
||||
conversion = true
|
||||
codegen.nameconversion(idl.types, idl.funcs)
|
||||
end
|
||||
return idl
|
||||
end
|
||||
|
||||
return codegen
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
local idl = require "idl"
|
||||
|
||||
do
|
||||
local doxygen = require "doxygen"
|
||||
local source = doxygen.load "bgfx.idl"
|
||||
local f = assert(load(source, "bgfx.idl" , "t", idl))
|
||||
f()
|
||||
|
||||
local codegen = require "codegen"
|
||||
codegen.nameconversion(idl.types, idl.funcs)
|
||||
end
|
||||
local codegen = require "codegen"
|
||||
local idl = codegen.idl "bgfx.idl"
|
||||
|
||||
local csharp_template = [[
|
||||
using System;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local idl = require "idl"
|
||||
|
||||
local doxygen = {}
|
||||
|
||||
function doxygen.load(filename)
|
||||
|
|
Loading…
Reference in New Issue