public virtual void WriteForwardDecls() { var getReferencedDecls = new GetReferencedDecls(); Unit.Visit(getReferencedDecls); foreach (var decl in getReferencedDecls.Enums.Where( c => c.TranslationUnit == TranslationUnit && c.IsGenerated)) { decl.Visit(this); } }
public override void WriteForwardDecls() { var refs = new GetReferencedDecls(); TranslationUnit.Visit(refs); var classes = refs.Classes.ToList(); classes.RemoveAll((c) => c == GenerateArrayTypes.MonoEmbedArray); classes.RemoveAll((c) => c == GenerateObjectTypesPass.MonoEmbedObject); PushBlock(); foreach (var @class in classes.Distinct()) { WriteLine($"@class {@class.QualifiedName};"); } PopBlock(NewLineKind.BeforeNextBlock); }
public void GenerateObjectDeclarations() { var referencedClasses = new GetReferencedDecls(); Unit.Visit(referencedClasses); var classNames = referencedClasses.Classes .Where(c => c != GenerateObjectTypesPass.MonoEmbedObject) .Select(c => c.QualifiedName) .Distinct(); foreach (var @class in classNames) { PushBlock(); WriteLine($"static MonoClass* class_{@class} = 0;"); PopBlock(NewLineKind.Never); } NewLine(); }
public override void WriteHeaders() { WriteLine("#pragma once"); NewLine(); WriteInclude("glib.h"); WriteInclude("mono_embeddinator.h"); WriteInclude("c-support.h"); // Find dependent headers var referencedDecls = new GetReferencedDecls(); Unit.Visit(referencedDecls); var dependencies = referencedDecls.Declarations .Where(d => !d.IsImplicit && d.TranslationUnit != Unit) .Select(d => d.TranslationUnit).Distinct(); foreach (var dep in dependencies) { WriteInclude($"{dep.TranslationUnit.FileNameWithoutExtension}.h"); } }