Beispiel #1
0
        void WriteFile(FullEnumFileInfo info, EnumType enumType)
        {
            using (var writer = new FileWriter(TargetLanguage.CSharp, FileUtils.OpenWrite(info.Filename))) {
                writer.WriteFileHeader();
                if (!(info.Define is null))
                {
                    writer.WriteLine($"#if {info.Define}");
                }

                if (enumType.IsFlags)
                {
                    writer.WriteLine("using System;");
                    writer.WriteLine();
                }

                writer.WriteLine($"namespace {info.Namespace} {{");

                using (writer.Indent())
                    WriteEnum(writer, enumType, info.BaseType);

                writer.WriteLine("}");
                if (!(info.Define is null))
                {
                    writer.WriteLine("#endif");
                }
            }
        }
Beispiel #2
0
        void WriteFile(FullEnumFileInfo info, EnumType enumType)
        {
            var docWriter = new LuaDocCommentWriter(luaIdConverter);

            using (var writer = new FileWriter(TargetLanguage.Lua, FileUtils.OpenWrite(info.Filename))) {
                writer.WriteFileHeader();
                docWriter.WriteSummary(writer, enumType.Documentation.GetComment(TargetLanguage.Lua), enumType.RawName);
                writer.WriteLine("return {");
                using (writer.Indent())
                    WriteEnumCore(writer, enumType, docWriter);
                writer.WriteLine("}");
            }
        }
Beispiel #3
0
        void WriteFile(FullEnumFileInfo info, EnumType enumType)
        {
            var docWriter = new PythonDocCommentWriter(pythonIdConverter, TargetLanguage.Python, isInRootModule: false);

            using (var writer = new FileWriter(TargetLanguage.Python, FileUtils.OpenWrite(info.Filename))) {
                writer.WriteFileHeader();
                writer.WriteLine("# pylint: disable=invalid-name");
                writer.WriteLine("# pylint: disable=line-too-long");
                writer.WriteLine("# pylint: disable=too-many-lines");
                writer.WriteLine();
                docWriter.WriteSummary(writer, enumType.Documentation, enumType.RawName);
                writer.WriteLine();
                WriteEnumCore(writer, enumType, docWriter);
            }
        }
Beispiel #4
0
        void WriteFile(FullEnumFileInfo info, EnumType enumType)
        {
            var docWriter = new PythonDocCommentWriter(pythonIdConverter, TargetLanguage.Python, isInRootModule: false);

            using (var writer = new FileWriter(TargetLanguage.Python, FileUtils.OpenWrite(info.Filename))) {
                writer.WriteFileHeader();
                writer.WriteLine("# pylint: disable=invalid-name");
                writer.WriteLine("# pylint: disable=line-too-long");
                writer.WriteLine("# pylint: disable=too-many-lines");
                writer.WriteLine();
                docWriter.WriteSummary(writer, enumType.Documentation.GetComment(TargetLanguage.Python), enumType.RawName);
                writer.WriteLine();
                // Needed by Sphinx or it will generate a lot of errors
                writer.WriteLine("import typing");
                writer.WriteLine("if typing.TYPE_CHECKING:");
                using (writer.Indent())
                    writer.WriteLine($"from ._iced_x86_py import {enumType.Name(pythonIdConverter)}");
                writer.WriteLine("else:");
                using (writer.Indent())
                    writer.WriteLine($"{enumType.Name(pythonIdConverter)} = int");
                writer.WriteLine();
                WriteEnumCore(writer, enumType, docWriter);
            }
        }