Skip to content

Instantly share code, notes, and snippets.

@raizam
Created October 7, 2018 18:58
Show Gist options
  • Save raizam/942e86e7f03d28b9c3e6c1081158875d to your computer and use it in GitHub Desktop.
Save raizam/942e86e7f03d28b9c3e6c1081158875d to your computer and use it in GitHub Desktop.
namespace CXApi;
enum CppPrimitiveKind : ushort
{
Unknown = 0, Void, Ptr, Bool,
Char, WideChar, SChar,
UInt16, UInt32, UInt64,
Int16, Int32, Int64,
Float32, Float64
}
enum CppTypeRefAttributes : ubyte (bit_flags)
{ IsConst,
IsPtr,
IsAddressOf
}
enum CppFunctionAttributes : ulong (bit_flags)
{ IsStatic,
IsCFunction,
IsCtor,
IsDtor,
IsVirtual,
IsPureVirtual,
}
enum CppFieldAttributes : ulong (bit_flags)
{ IsStatic, IsVolatile
}
table CppPrimitive
{
name : string(required);
kind: CppPrimitiveKind;
}
table CppArgument
{
name: string (required);
type: CppTypeRef(required);
position: ubyte;
}
table CppTypeRef
{
typeIdx: uint;
attributes: CppTypeRefAttributes;
indirections: ubyte = 0;
}
table CppEnumMember
{
name: string(required);
value: int64;
}
table CppEnum
{
enumValues: [CppEnumMember];
enumType: CppPrimitiveKind;
}
union CppTypeInfo { CppEnum, CppPrimitive, CppStructure, CppFunctionSignature }
table CppType
{
name:string(required);
typeInfo: CppTypeInfo(required);
}
table CppFunctionSignature
{
returns: CppTypeRef;
args: [CppArgument];
}
table CppFunction
{
name: string (required);
attributes: CppFunctionAttributes;
signature: CppFunctionSignature(required);
}
table CppField
{
name: string (required);
attributes: CppFieldAttributes;
offset: ushort;
type: CppTypeRef(required);
}
table CppStructure
{
fields: [CppField] (required);
function: [CppFunction] (required);
}
table CppApi
{
types: [CppType] (required);
functions: [CppFunction](required);
}
root_type CppApi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment