add a 'unicode' property to modules (not yet supported by mingw, need to add a librar...
[reactos.git] / reactos / tools / rbuild / rbuild.h
index 7eb1a4f..87992f1 100644 (file)
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2005 Casper S. Hornstrup
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
 #ifndef __RBUILD_H
 #define __RBUILD_H
 
@@ -40,6 +57,8 @@ typedef std::vector<std::string> string_list;
 #define SBAD_SEP "\\"
 #endif
 
+#define MS_VS_DEF_VERSION "7.10"
+
 class Project;
 class IfableData;
 class Module;
@@ -76,6 +95,9 @@ public:
        bool Verbose;
        bool CleanAsYouGo;
        bool AutomaticDependencies;
+       bool CheckDependenciesForModuleOnly;
+       std::string CheckDependenciesForModuleOnlyModule;
+       std::string VSProjectVersion;
        bool MakeHandlesInstallDirectories;
        bool GenerateProxyMakefilesInSourceTree;
 };
@@ -174,7 +196,8 @@ enum ModuleType
        LiveIso = 14,
        Test = 15,
        RpcServer = 16,
-       RpcClient = 17
+       RpcClient = 17,
+       Alias = 18
 };
 
 enum HostType
@@ -191,6 +214,7 @@ public:
        const XMLElement& node;
        std::string xmlbuildFile;
        std::string name;
+       std::string guid;
        std::string extension;
        std::string entrypoint;
        std::string baseaddress;
@@ -198,6 +222,7 @@ public:
        ModuleType type;
        ImportLibrary* importLibrary;
        bool mangledSymbols;
+       bool isUnicode;
        Bootstrap* bootstrap;
        IfableData non_if_data;
        std::vector<Invoke*> invocations;
@@ -211,8 +236,9 @@ public:
        HostType host;
        std::string installBase;
        std::string installName;
+       std::string aliasedModuleName;
        bool useWRC;
-       bool enableWarnings;
+       bool allowWarnings;
        bool enabled;
 
        Module ( const Project& project,
@@ -224,11 +250,11 @@ public:
        bool HasImportLibrary () const;
        bool IsDLL () const;
        bool GenerateInOutputTree () const;
-       std::string GetTargetName () const;
-       std::string GetDependencyPath () const;
-       std::string GetBasePath () const;
-       std::string GetPath () const;
-       std::string GetPathWithPrefix ( const std::string& prefix ) const;
+       std::string GetTargetName () const; // "foo.exe"
+       std::string GetDependencyPath () const; // "path/foo.exe" or "path/libfoo.a"
+       std::string GetBasePath () const; // "path"
+       std::string GetPath () const; // "path/foo.exe"
+       std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe"
        void GetTargets ( string_list& ) const;
        std::string GetInvocationTarget ( const int index ) const;
        bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;
@@ -251,19 +277,22 @@ class Include
 public:
        const Project& project;
        const Module* module;
-       const XMLElement& node;
+       const XMLElement* node;
+       const Module* baseModule;
        std::string directory;
        std::string basePath;
 
        Include ( const Project& project,
-                 const XMLElement& includeNode );
+                 const XMLElement* includeNode );
        Include ( const Project& project,
                  const Module* module,
-                 const XMLElement& includeNode );
+                 const XMLElement* includeNode );
+       Include ( const Project& project,
+                 std::string directory,
+                 std::string basePath );
        ~Include ();
        void ProcessXML();
 private:
-       void Initialize();
 };
 
 
@@ -312,7 +341,7 @@ public:
        const XMLElement& node;
        const Module& module;
        std::string name;
-       const Module* imported_module;
+       const Module* importedModule;
 
        Library ( const XMLElement& _node,
                  const Module& _module,
@@ -393,12 +422,14 @@ public:
        const XMLElement& node;
        const Project& project;
        const Module* module;
+       const bool negated;
        std::string property, value;
        IfableData data;
 
        If ( const XMLElement& node_,
             const Project& project_,
-            const Module* module_ );
+            const Module* module_,
+            const bool negated_ = false );
        ~If();
 
        void ProcessXML();
@@ -490,6 +521,7 @@ private:
                                                 int* stubIndex );
        void WriteStubsFile ( Module& module );
        std::string GetStartupFilename ( Module& module );
+       bool IsUnknownCharacter ( char ch );
        std::string GetTestDispatcherName ( std::string filename );
        bool IsTestFile ( std::string& filename ) const;
        void GetSourceFilenames ( string_list& list,
@@ -526,7 +558,7 @@ class SourceFile
 {
 public:
        SourceFile ( AutomaticDependency* automaticDependency,
-                    Module& module,
+                    const Module& module,
                     const std::string& filename,
                     SourceFile* parent,
                     bool isNonAutomaticDependency );
@@ -535,7 +567,7 @@ public:
        std::string Location () const;
        std::vector<SourceFile*> files;
        AutomaticDependency* automaticDependency;
-       Module& module;
+       const Module& module;
        std::string filename;
        std::string filenamePart;
        std::string directoryPart;
@@ -551,6 +583,7 @@ private:
        void Open ();
        void SkipWhitespace ();
        bool ReadInclude ( std::string& filename,
+                          bool& searchCurrentDirectory,
                           bool& includeNext );
        bool IsIncludedFrom ( const std::string& normalizedFilename );
        SourceFile* GetParentSourceFile ();
@@ -571,28 +604,38 @@ public:
 
        AutomaticDependency ( const Project& project );
        ~AutomaticDependency ();
-       void Process ();
        std::string GetFilename ( const std::string& filename );
        bool LocateIncludedFile ( const std::string& directory,
                                  const std::string& includedFilename,
                                  std::string& resolvedFilename );
        bool LocateIncludedFile ( SourceFile* sourceFile,
-                                 Module& module,
+                                 const Module& module,
                                  const std::string& includedFilename,
+                                 bool searchCurrentDirectory,
                                  bool includeNext,
                                  std::string& resolvedFilename );
-       SourceFile* RetrieveFromCacheOrParse ( Module& module,
+       SourceFile* RetrieveFromCacheOrParse ( const Module& module,
                                               const std::string& filename,
                                               SourceFile* parentSourceFile );
        SourceFile* RetrieveFromCache ( const std::string& filename );
        void CheckAutomaticDependencies ( bool verbose );
-       void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
+       void CheckAutomaticDependenciesForModule ( Module& module,
+                                                  bool verbose );
 private:
-       void GetModuleFiles ( Module& module,
+       void GetModulesToCheck ( Module& module, std::vector<const Module*>& modules );
+       void CheckAutomaticDependencies ( const Module& module,
+                                          bool verbose );
+       void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
+       void GetIncludeDirectories ( std::vector<Include*>& includes,
+                                    const Module& module,
+                                     Include& currentDirectory,
+                                     bool searchCurrentDirectory );
+       void GetModuleFiles ( const Module& module,
                               std::vector<File*>& files ) const;
-       void ProcessModule ( Module& module );
-       void ProcessFile ( Module& module,
-                          const File& file );
+       void ParseFiles ();
+       void ParseFiles ( const Module& module );
+       void ParseFile ( const Module& module,
+                        const File& file );
        std::map<std::string, SourceFile*> sourcefile_map;
 };
 
@@ -701,9 +744,18 @@ private:
        std::string StripSymbol ( std::string symbol );
 };
 
+extern std::string
+Right ( const std::string& s, size_t n );
+
+extern std::string
+Replace ( const std::string& s, const std::string& find, const std::string& with );
+
 extern std::string
 FixSeparator ( const std::string& s );
 
+extern std::string
+DosSeparator ( const std::string& s );
+
 extern std::string
 ReplaceExtension (
        const std::string& filename,