From 88229d8b7175f2db4bae2374c57cda317001fa03 Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 3 Sep 2013 11:03:06 +0100 Subject: [PATCH] Cleaned up Parser.h. --- src/Parser/Options.h | 91 ++++++++++++++++++++++++++++++++++++++ src/Parser/Parser.h | 101 ++----------------------------------------- 2 files changed, 95 insertions(+), 97 deletions(-) create mode 100644 src/Parser/Options.h diff --git a/src/Parser/Options.h b/src/Parser/Options.h new file mode 100644 index 00000000..2b410e86 --- /dev/null +++ b/src/Parser/Options.h @@ -0,0 +1,91 @@ +/************************************************************************ +* +* CppSharp +* Licensed under the simplified BSD license. All rights reserved. +* +************************************************************************/ + +#using +#include +using namespace System::Collections::Generic; + +public ref struct ParserOptions +{ + ParserOptions() + { + IncludeDirs = gcnew List(); + SystemIncludeDirs = gcnew List(); + Defines = gcnew List(); + LibraryDirs = gcnew List(); + MicrosoftMode = false; + NoStandardIncludes = false; + NoBuiltinIncludes = false; + } + + // Include directories + List^ IncludeDirs; + List^ SystemIncludeDirs; + List^ Defines; + List^ LibraryDirs; + + // C/C++ header file name. + System::String^ FileName; + + CppSharp::AST::Library^ Library; + + int ToolSetToUse; + System::String^ TargetTriple; + + bool NoStandardIncludes; + bool NoBuiltinIncludes; + bool MicrosoftMode; + CppSharp::AST::CppAbi Abi; + + bool Verbose; +}; + +public enum struct ParserDiagnosticLevel +{ + Ignored, + Note, + Warning, + Error, + Fatal +}; + +public value struct ParserDiagnostic +{ + System::String^ FileName; + System::String^ Message; + ParserDiagnosticLevel Level; + int LineNumber; + int ColumnNumber; +}; + +public enum struct ParserResultKind +{ + Success, + Error, + FileNotFound +}; + +public ref struct ParserResult +{ + ParserResult() + { + Diagnostics = gcnew List(); + } + + ParserResultKind Kind; + CppSharp::AST::Library^ Library; + List^ Diagnostics; +}; + +enum class SourceLocationKind +{ + Invalid, + Builtin, + CommandLine, + System, + User +}; \ No newline at end of file diff --git a/src/Parser/Parser.h b/src/Parser/Parser.h index 101e530e..446011eb 100644 --- a/src/Parser/Parser.h +++ b/src/Parser/Parser.h @@ -24,6 +24,10 @@ #include #include #include "CXXABI.h" +#include "Options.h" + +#include +typedef std::string String; namespace clang { class TargetCodeGenInfo; @@ -32,98 +36,8 @@ namespace clang { } } -#include -#include - -#using -#include - -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) #define Debug printf -using namespace System::Collections::Generic; - -public ref struct ParserOptions -{ - ParserOptions() - { - IncludeDirs = gcnew List(); - SystemIncludeDirs = gcnew List(); - Defines = gcnew List(); - LibraryDirs = gcnew List(); - MicrosoftMode = false; - NoStandardIncludes = false; - NoBuiltinIncludes = false; - } - - // Include directories - List^ IncludeDirs; - List^ SystemIncludeDirs; - List^ Defines; - List^ LibraryDirs; - - // C/C++ header file name. - System::String^ FileName; - - CppSharp::AST::Library^ Library; - - int ToolSetToUse; - System::String^ TargetTriple; - - bool NoStandardIncludes; - bool NoBuiltinIncludes; - bool MicrosoftMode; - CppSharp::AST::CppAbi Abi; - - bool Verbose; -}; - -public enum struct ParserDiagnosticLevel -{ - Ignored, - Note, - Warning, - Error, - Fatal -}; - -public value struct ParserDiagnostic -{ - System::String^ FileName; - System::String^ Message; - ParserDiagnosticLevel Level; - int LineNumber; - int ColumnNumber; -}; - -public enum struct ParserResultKind -{ - Success, - Error, - FileNotFound -}; - -public ref struct ParserResult -{ - ParserResult() - { - Diagnostics = gcnew List(); - } - - ParserResultKind Kind; - CppSharp::AST::Library^ Library; - List^ Diagnostics; -}; - -enum class SourceLocationKind -{ - Invalid, - Builtin, - CommandLine, - System, - User -}; - struct Parser { Parser(ParserOptions^ Opts); @@ -195,10 +109,3 @@ protected: clang::TargetCodeGenInfo* CodeGenInfo; clang::CodeGen::CodeGenTypes* CodeGenTypes; }; - -//-----------------------------------// - -typedef std::string String; - -String StringFormatArgs(const char* str, va_list args); -String StringFormat(const char* str, ...);