mirror of https://github.com/mono/CppSharp.git
11 changed files with 40 additions and 269 deletions
@ -1,91 +0,0 @@ |
|||||||
using Cxxi.Generators; |
|
||||||
using Cxxi.Passes; |
|
||||||
using Cxxi.Templates; |
|
||||||
using Generator = Cxxi.Generators.Generator; |
|
||||||
|
|
||||||
namespace Cxxi |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Transform the Clang library declarations to something more .NET friendly.
|
|
||||||
/// </summary>
|
|
||||||
class Clang : ILibrary |
|
||||||
{ |
|
||||||
public void Preprocess(LibraryHelpers g) |
|
||||||
{ |
|
||||||
//g.SetNameOfEnumWithMatchingItem("SDL_LOG_CATEGORY_CUSTOM", "LogCategory");
|
|
||||||
|
|
||||||
// Clean up types
|
|
||||||
g.FindClass("CXString").IsOpaque = true; |
|
||||||
g.FindClass("CXSourceLocation").IsOpaque = true; |
|
||||||
g.FindClass("CXSourceRange").IsOpaque = true; |
|
||||||
g.FindClass("CXCursor").IsOpaque = true; |
|
||||||
g.FindClass("CXType").IsOpaque = true; |
|
||||||
g.FindClass("CXToken").IsOpaque = true; |
|
||||||
g.FindClass("CXIdxLoc").IsOpaque = true; |
|
||||||
g.FindClass("CXTranslationUnitImpl").IsOpaque = true; |
|
||||||
} |
|
||||||
|
|
||||||
public void Postprocess(LibraryHelpers g) |
|
||||||
{ |
|
||||||
g.FindEnum("CompletionContext").SetFlags(); |
|
||||||
g.FindClass("String").Name = "CXString"; |
|
||||||
//gen.SetNameOfEnumWithName("LOG_CATEGORY", "LogCategory");
|
|
||||||
} |
|
||||||
|
|
||||||
public void Postprocess(Generators.Generator generator) |
|
||||||
{ |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public void SetupPasses(PassBuilder p) |
|
||||||
{ |
|
||||||
p.RemovePrefix("CX"); |
|
||||||
p.RemovePrefix("clang_"); |
|
||||||
p.RenameWithPattern("^_", string.Empty, RenameTargets.Any); |
|
||||||
|
|
||||||
// Clean up enums
|
|
||||||
p.RemovePrefixEnumItem("ChildVisit_"); |
|
||||||
p.RemovePrefixEnumItem("Comment_"); |
|
||||||
p.RemovePrefixEnumItem("Availability_"); |
|
||||||
p.RemovePrefixEnumItem("GlobalOpt_"); |
|
||||||
p.RemovePrefixEnumItem("Diagnostic_"); |
|
||||||
p.RemovePrefixEnumItem("LoadDiag_"); |
|
||||||
p.RemovePrefixEnumItem("TranslationUnit_"); |
|
||||||
p.RemovePrefixEnumItem("SaveTranslationUnit_"); |
|
||||||
p.RemovePrefixEnumItem("SaveError_"); |
|
||||||
p.RemovePrefixEnumItem("TranslationUnit_"); |
|
||||||
p.RemovePrefixEnumItem("Reparse_"); |
|
||||||
p.RemovePrefixEnumItem("TUResourceUsage_"); |
|
||||||
p.RemovePrefixEnumItem("Cursor_"); |
|
||||||
p.RemovePrefixEnumItem("Linkage_"); |
|
||||||
p.RemovePrefixEnumItem("Language_"); |
|
||||||
p.RemovePrefixEnumItem("Type_"); |
|
||||||
p.RemovePrefixEnumItem("CallingConv_"); |
|
||||||
p.RemovePrefixEnumItem("CommentInlineCommandRenderKind_"); |
|
||||||
p.RemovePrefixEnumItem("CommentParamPassDirection_"); |
|
||||||
p.RemovePrefixEnumItem("NameRange_"); |
|
||||||
p.RemovePrefixEnumItem("Token_"); |
|
||||||
p.RemovePrefixEnumItem("CompletionChunk_"); |
|
||||||
p.RemovePrefixEnumItem("CodeComplete_"); |
|
||||||
p.RemovePrefixEnumItem("CompletionContext_"); |
|
||||||
p.RemovePrefixEnumItem("Visit_"); |
|
||||||
p.RemovePrefixEnumItem("IdxEntity_"); |
|
||||||
p.RemovePrefixEnumItem("IdxEntityLang_"); |
|
||||||
p.RemovePrefixEnumItem("IdxAttr_"); |
|
||||||
p.RemovePrefixEnumItem("IdxObjCContainer_"); |
|
||||||
p.RemovePrefixEnumItem("IdxEntityRef_"); |
|
||||||
p.RemovePrefixEnumItem("IndexOpt_"); |
|
||||||
p.RemovePrefixEnumItem("IdxObjCContainer_"); |
|
||||||
} |
|
||||||
|
|
||||||
public void GenerateStart(TextTemplate template) |
|
||||||
{ |
|
||||||
throw new System.NotImplementedException(); |
|
||||||
} |
|
||||||
|
|
||||||
public void GenerateAfterNamespaces(TextTemplate template) |
|
||||||
{ |
|
||||||
throw new System.NotImplementedException(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,36 +0,0 @@ |
|||||||
using System.Reflection; |
|
||||||
using System.Runtime.CompilerServices; |
|
||||||
using System.Runtime.InteropServices; |
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Clang")] |
|
||||||
[assembly: AssemblyDescription("")] |
|
||||||
[assembly: AssemblyConfiguration("")] |
|
||||||
[assembly: AssemblyCompany("")] |
|
||||||
[assembly: AssemblyProduct("Clang")] |
|
||||||
[assembly: AssemblyCopyright("Copyright © 2013")] |
|
||||||
[assembly: AssemblyTrademark("")] |
|
||||||
[assembly: AssemblyCulture("")] |
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)] |
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("e7c52cd3-e09e-43ba-91e4-82bc31315f7c")] |
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")] |
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|
@ -1,52 +0,0 @@ |
|||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.IO; |
|
||||||
using System.Runtime.Serialization.Formatters.Binary; |
|
||||||
|
|
||||||
[Serializable] |
|
||||||
class FileHashes |
|
||||||
{ |
|
||||||
private string serializedFile; |
|
||||||
private Dictionary<string, int> fileHashes = new Dictionary<string, int>(); |
|
||||||
|
|
||||||
public bool UpdateHash(string file, int hash) |
|
||||||
{ |
|
||||||
if(!fileHashes.ContainsKey(file)) |
|
||||||
{ |
|
||||||
fileHashes.Add(file, hash); |
|
||||||
Save(this, serializedFile); |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
var oldHash = fileHashes[file]; |
|
||||||
fileHashes[file] = hash; |
|
||||||
Save(this, serializedFile); |
|
||||||
|
|
||||||
return oldHash != hash; |
|
||||||
} |
|
||||||
|
|
||||||
public static FileHashes Load(string file) |
|
||||||
{ |
|
||||||
var stream = File.Open(file, FileMode.OpenOrCreate); |
|
||||||
var bformatter = new BinaryFormatter(); |
|
||||||
|
|
||||||
FileHashes obj; |
|
||||||
if(stream.Length>0) |
|
||||||
obj = (FileHashes)bformatter.Deserialize(stream); |
|
||||||
else |
|
||||||
obj = new FileHashes(); |
|
||||||
obj.serializedFile = file; |
|
||||||
stream.Close(); |
|
||||||
|
|
||||||
return obj; |
|
||||||
} |
|
||||||
|
|
||||||
public static void Save(FileHashes obj, string file) |
|
||||||
{ |
|
||||||
Stream stream = File.Open(file, FileMode.Create); |
|
||||||
BinaryFormatter bformatter = new BinaryFormatter(); |
|
||||||
|
|
||||||
bformatter.Serialize(stream, obj); |
|
||||||
stream.Close(); |
|
||||||
} |
|
||||||
} |
|
@ -1,34 +0,0 @@ |
|||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.IO; |
|
||||||
|
|
||||||
public static class Glob |
|
||||||
{ |
|
||||||
static public string[] GetFiles(string[] patterns) |
|
||||||
{ |
|
||||||
List<string> filelist = new List<string>(); |
|
||||||
foreach (string pattern in patterns) |
|
||||||
filelist.AddRange(GetFiles(pattern)); |
|
||||||
string[] files = new string[filelist.Count]; |
|
||||||
filelist.CopyTo(files, 0); |
|
||||||
return files; |
|
||||||
} |
|
||||||
|
|
||||||
static public string[] GetFiles(string patternlist) |
|
||||||
{ |
|
||||||
List<string> filelist = new List<string>(); |
|
||||||
foreach (string pattern in |
|
||||||
patternlist.Split(Path.GetInvalidPathChars())) |
|
||||||
{ |
|
||||||
string dir = Path.GetDirectoryName(pattern); |
|
||||||
if (String.IsNullOrEmpty(dir)) dir = |
|
||||||
Directory.GetCurrentDirectory(); |
|
||||||
filelist.AddRange(Directory.GetFiles( |
|
||||||
Path.GetFullPath(dir), |
|
||||||
Path.GetFileName(pattern))); |
|
||||||
} |
|
||||||
string[] files = new string[filelist.Count]; |
|
||||||
filelist.CopyTo(files, 0); |
|
||||||
return files; |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue