increase custamizability
This commit is contained in:
@@ -157,8 +157,8 @@ static class Program
|
|||||||
StreamWriter includeAll = scope .()..Create("clang-c.h");
|
StreamWriter includeAll = scope .()..Create("clang-c.h");
|
||||||
for (let file in clangFiles)
|
for (let file in clangFiles)
|
||||||
{
|
{
|
||||||
//if (system(scope $"curl -o {clangHeaders}/{file}.h https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang/include/clang-c/{file}.h") != 0)
|
if (system(scope $"wget -O {clangHeaders}/{file}.h https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang/include/clang-c/{file}.h") != 0)
|
||||||
// Runtime.FatalError(scope $"Failed to download clang-c/{file}");
|
Runtime.FatalError(scope $"Failed to download clang-c/{file}");
|
||||||
includeAll.Write($"#include <clang-c/{file}.h>\n");
|
includeAll.Write($"#include <clang-c/{file}.h>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ abstract class Cpp2BeefGenerator
|
|||||||
|
|
||||||
case .FieldDecl: BeginCursor(cursor); FieldDecl(cursor);
|
case .FieldDecl: BeginCursor(cursor); FieldDecl(cursor);
|
||||||
case .VarDecl: BeginCursor(cursor); VarDecl(cursor);
|
case .VarDecl: BeginCursor(cursor); VarDecl(cursor);
|
||||||
|
case .EnumConstantDecl: BeginCursor(cursor); EnumConstantDecl(cursor);
|
||||||
|
|
||||||
case .MacroDefinition:
|
case .MacroDefinition:
|
||||||
if (Clang.Cursor_IsMacroFunctionLike(cursor) != 0) return;
|
if (Clang.Cursor_IsMacroFunctionLike(cursor) != 0) return;
|
||||||
@@ -444,7 +445,8 @@ abstract class Cpp2BeefGenerator
|
|||||||
for (; i < file.Length && file[i].IsWhiteSpace; i++) outString.Append(file[i]);
|
for (; i < file.Length && file[i].IsWhiteSpace; i++) outString.Append(file[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void AllWhiteSpaceUntil(CXSourceLocation from, enum { NoNewLines, YesNewLines } newlineMode)
|
protected enum WhiteSpaceNewLineMode { NoNewLines, YesNewLines }
|
||||||
|
protected virtual void AllWhiteSpaceUntil(CXSourceLocation from, WhiteSpaceNewLineMode newlineMode)
|
||||||
{
|
{
|
||||||
StringView file;
|
StringView file;
|
||||||
uint32 offset;
|
uint32 offset;
|
||||||
@@ -779,7 +781,7 @@ abstract class Cpp2BeefGenerator
|
|||||||
str.Append(')');
|
str.Append(')');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AccessSpecifier(CXCursor cursor)
|
protected virtual void AccessSpecifier(CXCursor cursor)
|
||||||
{
|
{
|
||||||
switch (Clang.GetCXXAccessSpecifier(cursor))
|
switch (Clang.GetCXXAccessSpecifier(cursor))
|
||||||
{
|
{
|
||||||
@@ -790,6 +792,11 @@ abstract class Cpp2BeefGenerator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual bool IsEmptyStructOpaque(CXCursor cursor)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected mixin BeginBody(CXCursor cursor)
|
protected mixin BeginBody(CXCursor cursor)
|
||||||
{
|
{
|
||||||
fileInfo.prevEnd = GetCursorAnchor(cursor);
|
fileInfo.prevEnd = GetCursorAnchor(cursor);
|
||||||
@@ -817,6 +824,8 @@ abstract class Cpp2BeefGenerator
|
|||||||
switch (cursor.kind)
|
switch (cursor.kind)
|
||||||
{
|
{
|
||||||
case .StructDecl, .UnionDecl, .ClassDecl:
|
case .StructDecl, .UnionDecl, .ClassDecl:
|
||||||
|
if (!IsEmptyStructOpaque(cursor))
|
||||||
|
fallthrough;
|
||||||
str.Append(';');
|
str.Append(';');
|
||||||
default:
|
default:
|
||||||
str.Append(" {}");
|
str.Append(" {}");
|
||||||
@@ -1392,18 +1401,21 @@ abstract class Cpp2BeefGenerator
|
|||||||
{
|
{
|
||||||
Self self = (.)Internal.UnsafeCastToObject(client_data);
|
Self self = (.)Internal.UnsafeCastToObject(client_data);
|
||||||
Runtime.Assert(cursor.kind == .EnumConstantDecl);
|
Runtime.Assert(cursor.kind == .EnumConstantDecl);
|
||||||
|
self.HandleCursor(cursor);
|
||||||
self.BeginCursor(cursor);
|
|
||||||
self.WriteCustomAttributes(cursor);
|
|
||||||
self.GetNameInBindings(cursor, self.str);
|
|
||||||
self.WriteTokensAfterEquals(cursor);
|
|
||||||
//Clang.GetEnumConstantDeclValue(cursor).ToString(self.str);
|
|
||||||
self.str.Append(',');
|
|
||||||
|
|
||||||
return .Continue;
|
return .Continue;
|
||||||
}, Internal.UnsafeCastToPtr(this));
|
}, Internal.UnsafeCastToPtr(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void EnumConstantDecl(CXCursor cursor)
|
||||||
|
{
|
||||||
|
BeginCursor(cursor);
|
||||||
|
WriteCustomAttributes(cursor);
|
||||||
|
GetNameInBindings(cursor, str);
|
||||||
|
WriteTokensAfterEquals(cursor);
|
||||||
|
//Clang.GetEnumConstantDeclValue(cursor).ToString(str);
|
||||||
|
str.Append(',');
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void TypeAlias(CXCursor cursor)
|
protected virtual void TypeAlias(CXCursor cursor)
|
||||||
{
|
{
|
||||||
CXType type;
|
CXType type;
|
||||||
|
|||||||
Reference in New Issue
Block a user