917512a07c12a7182d9cf3bd19b007884f47ff25
[reactos.git] / reactos / tools / rbuild / rbuild.h
1 /*
2 * Copyright (C) 2005 Casper S. Hornstrup
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 #ifndef __RBUILD_H
19 #define __RBUILD_H
20
21 #include "pch.h"
22
23 #ifdef WIN32
24 #include <direct.h>
25 #include <io.h>
26 #endif/*WIN32*/
27 #include <sys/stat.h>
28 #include <time.h>
29 #ifdef _MSC_VER
30 #include <sys/utime.h>
31 #else/*_MSC_VER*/
32 #include <utime.h>
33 #ifdef WIN32
34 #include <process.h>
35 #endif/*WIN32*/
36 #endif/*_MSC_VER*/
37
38 #include <infhost.h>
39
40 #include "ssprintf.h"
41 #include "exception.h"
42 #include "xml.h"
43
44 class Backend; // forward declaration
45
46 typedef std::vector<std::string> string_list;
47
48 extern std::string ExePrefix;
49 extern std::string ExePostfix;
50 extern std::string sSep;
51 extern std::string sBadSep;
52 extern char cSep;
53 extern char cBadSep;
54
55 #ifdef WIN32
56 #define DEF_EXEPREFIX ""
57 #define DEF_EXEPOSTFIX ".exe"
58 #define DEF_CSEP '\\'
59 #define DEF_CBAD_SEP '/'
60 #define DEF_SSEP "\\"
61 #define DEF_SBAD_SEP "/"
62 #else
63 #define DEF_EXEPREFIX "./"
64 #define DEF_EXEPOSTFIX ""
65 #define DEF_CSEP '/'
66 #define DEF_CBAD_SEP '\\'
67 #define DEF_SSEP "/"
68 #define DEF_SBAD_SEP "\\"
69 #endif
70
71 #define MS_VS_DEF_VERSION "7.10"
72
73 class Directory;
74 class Project;
75 class IfableData;
76 class Module;
77 class Include;
78 class Define;
79 class File;
80 class Library;
81 class Invoke;
82 class InvokeFile;
83 class Dependency;
84 class ImportLibrary;
85 class If;
86 class CompilerFlag;
87 class LinkerFlag;
88 class LinkerScript;
89 class Property;
90 class TestSupportCode;
91 class WineResource;
92 class AutomaticDependency;
93 class Bootstrap;
94 class CDFile;
95 class InstallFile;
96 class PchFile;
97 class StubbedComponent;
98 class StubbedSymbol;
99 class CompilationUnit;
100 class FileLocation;
101 class AutoRegister;
102
103 class SourceFileTest;
104
105
106 typedef std::map<std::string,Directory*> directory_map;
107
108 class Directory
109 {
110 public:
111 std::string name;
112 directory_map subdirs;
113 Directory ( const std::string& name );
114 void Add ( const char* subdir );
115 void GenerateTree ( const std::string& parent,
116 bool verbose );
117 std::string EscapeSpaces ( std::string path );
118 void CreateRule ( FILE* f,
119 const std::string& parent );
120 private:
121 bool mkdir_p ( const char* path );
122 std::string ReplaceVariable ( std::string name,
123 std::string value,
124 std::string path );
125 std::string GetEnvironmentVariable ( const std::string& name );
126 void ResolveVariablesInPath ( char* buf,
127 std::string path );
128 bool CreateDirectory ( std::string path );
129 };
130
131
132 class Configuration
133 {
134 public:
135 Configuration ();
136 ~Configuration ();
137 bool Verbose;
138 bool CleanAsYouGo;
139 bool AutomaticDependencies;
140 bool CheckDependenciesForModuleOnly;
141 bool CompilationUnitsEnabled;
142 std::string CheckDependenciesForModuleOnlyModule;
143 std::string VSProjectVersion;
144 bool MakeHandlesInstallDirectories;
145 bool GenerateProxyMakefilesInSourceTree;
146 };
147
148 class Environment
149 {
150 public:
151 static std::string GetVariable ( const std::string& name );
152 static std::string GetIntermediatePath ();
153 static std::string GetOutputPath ();
154 static std::string GetInstallPath ();
155 static std::string GetEnvironmentVariablePathOrDefault ( const std::string& name,
156 const std::string& defaultValue );
157 };
158
159
160 class FileSupportCode
161 {
162 public:
163 static void WriteIfChanged ( char* outbuf,
164 std::string filename );
165 };
166
167
168 class ParseContext
169 {
170 public:
171 If* ifData;
172 CompilationUnit* compilationUnit;
173 ParseContext ();
174 };
175
176
177 class IfableData
178 {
179 public:
180 std::vector<CompilationUnit*> compilationUnits;
181 std::vector<File*> files;
182 std::vector<Include*> includes;
183 std::vector<Define*> defines;
184 std::vector<Library*> libraries;
185 std::vector<Property*> properties;
186 std::vector<Module*> modules;
187 std::vector<CompilerFlag*> compilerFlags;
188 std::vector<If*> ifs;
189
190 ~IfableData();
191 void ProcessXML();
192 void ExtractModules( std::vector<Module*> &modules );
193 };
194
195 class Project
196 {
197 std::string xmlfile;
198 XMLElement *node, *head;
199 Backend* _backend;
200 public:
201 const Configuration& configuration;
202 std::string name;
203 std::string makefile;
204 XMLIncludes xmlbuildfiles;
205 std::vector<LinkerFlag*> linkerFlags;
206 std::vector<CDFile*> cdfiles;
207 std::vector<InstallFile*> installfiles;
208 std::vector<Module*> modules;
209 IfableData non_if_data;
210
211 Project ( const Configuration& configuration,
212 const std::string& filename );
213 ~Project ();
214 void SetBackend ( Backend* backend ) { _backend = backend; }
215 Backend& GetBackend() { return *_backend; }
216 void WriteConfigurationFile ();
217 void ExecuteInvocations ();
218
219 void ProcessXML ( const std::string& path );
220 Module* LocateModule ( const std::string& name );
221 const Module* LocateModule ( const std::string& name ) const;
222 std::string GetProjectFilename () const;
223 std::string ResolveProperties ( const std::string& s ) const;
224 private:
225 std::string ResolveNextProperty ( std::string& s ) const;
226 const Property* LookupProperty ( const std::string& name ) const;
227 void SetConfigurationOption ( char* s,
228 std::string name,
229 std::string* alternativeName );
230 void SetConfigurationOption ( char* s,
231 std::string name );
232 void ReadXml ();
233 void ProcessXMLSubElement ( const XMLElement& e,
234 const std::string& path,
235 ParseContext& parseContext );
236
237 // disable copy semantics
238 Project ( const Project& );
239 Project& operator = ( const Project& );
240 };
241
242
243 enum ModuleType
244 {
245 BuildTool = 0,
246 StaticLibrary = 1,
247 ObjectLibrary = 2,
248 Kernel = 3,
249 KernelModeDLL = 4,
250 KernelModeDriver = 5,
251 NativeDLL = 6,
252 NativeCUI = 7,
253 Win32DLL = 8,
254 Win32CUI = 9,
255 Win32GUI = 10,
256 BootLoader = 11,
257 BootSector = 12,
258 Iso = 13,
259 LiveIso = 14,
260 Test = 15,
261 RpcServer = 16,
262 RpcClient = 17,
263 Alias = 18,
264 BootProgram = 19
265 };
266
267 enum HostType
268 {
269 HostFalse,
270 HostDefault,
271 HostTrue
272 };
273
274 class Module
275 {
276 public:
277 const Project& project;
278 const XMLElement& node;
279 std::string xmlbuildFile;
280 std::string name;
281 std::string guid;
282 std::string extension;
283 std::string entrypoint;
284 std::string baseaddress;
285 std::string payload;
286 std::string path;
287 ModuleType type;
288 ImportLibrary* importLibrary;
289 bool mangledSymbols;
290 bool isUnicode;
291 Bootstrap* bootstrap;
292 AutoRegister* autoRegister;
293 IfableData non_if_data;
294 std::vector<Invoke*> invocations;
295 std::vector<Dependency*> dependencies;
296 std::vector<CompilerFlag*> compilerFlags;
297 std::vector<LinkerFlag*> linkerFlags;
298 std::vector<StubbedComponent*> stubbedComponents;
299 LinkerScript* linkerScript;
300 PchFile* pch;
301 bool cplusplus;
302 std::string prefix;
303 HostType host;
304 std::string installBase;
305 std::string installName;
306 std::string aliasedModuleName;
307 bool useWRC;
308 bool allowWarnings;
309 bool enabled;
310
311 Module ( const Project& project,
312 const XMLElement& moduleNode,
313 const std::string& modulePath );
314 ~Module ();
315 ModuleType GetModuleType ( const std::string& location,
316 const XMLAttribute& attribute );
317 bool HasImportLibrary () const;
318 bool IsDLL () const;
319 bool GenerateInOutputTree () const;
320 std::string GetTargetName () const; // "foo.exe"
321 std::string GetDependencyPath () const; // "path/foo.exe" or "path/libfoo.a"
322 std::string GetBasePath () const; // "path"
323 std::string GetPath () const; // "path/foo.exe"
324 std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe"
325 std::string GetPathToBaseDir() const; // "../" offset to rootdirectory
326 void GetTargets ( string_list& ) const;
327 std::string GetInvocationTarget ( const int index ) const;
328 bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;
329 void InvokeModule () const;
330 void ProcessXML ();
331 void GetSourceFilenames ( string_list& list,
332 bool includeGeneratedFiles ) const;
333 private:
334 std::string GetDefaultModuleExtension () const;
335 std::string GetDefaultModuleEntrypoint () const;
336 std::string GetDefaultModuleBaseaddress () const;
337 void ProcessXMLSubElement ( const XMLElement& e,
338 const std::string& path,
339 ParseContext& parseContext );
340 };
341
342
343 class Include
344 {
345 public:
346 const Project& project;
347 const Module* module;
348 const XMLElement* node;
349 const Module* baseModule;
350 std::string directory;
351 std::string basePath;
352
353 Include ( const Project& project,
354 const XMLElement* includeNode );
355 Include ( const Project& project,
356 const Module* module,
357 const XMLElement* includeNode );
358 Include ( const Project& project,
359 std::string directory,
360 std::string basePath );
361 ~Include ();
362 void ProcessXML();
363 private:
364 };
365
366
367 class Define
368 {
369 public:
370 const Project& project;
371 const Module* module;
372 const XMLElement& node;
373 std::string name;
374 std::string value;
375
376 Define ( const Project& project,
377 const XMLElement& defineNode );
378 Define ( const Project& project,
379 const Module* module,
380 const XMLElement& defineNode );
381 ~Define();
382 void ProcessXML();
383 private:
384 void Initialize();
385 };
386
387
388 class File
389 {
390 public:
391 std::string name;
392 bool first;
393 std::string switches;
394 bool isPreCompiledHeader;
395
396 File ( const std::string& _name,
397 bool _first,
398 std::string _switches,
399 bool _isPreCompiledHeader );
400
401 void ProcessXML();
402 };
403
404
405 class Library
406 {
407 public:
408 const XMLElement& node;
409 const Module& module;
410 std::string name;
411 const Module* importedModule;
412
413 Library ( const XMLElement& _node,
414 const Module& _module,
415 const std::string& _name );
416
417 void ProcessXML();
418 };
419
420
421 class Invoke
422 {
423 public:
424 const XMLElement& node;
425 const Module& module;
426 const Module* invokeModule;
427 std::vector<InvokeFile*> input;
428 std::vector<InvokeFile*> output;
429
430 Invoke ( const XMLElement& _node,
431 const Module& _module );
432
433 void ProcessXML();
434 void GetTargets ( string_list& targets ) const;
435 std::string GetParameters () const;
436 private:
437 void ProcessXMLSubElement ( const XMLElement& e );
438 void ProcessXMLSubElementInput ( const XMLElement& e );
439 void ProcessXMLSubElementOutput ( const XMLElement& e );
440 };
441
442
443 class InvokeFile
444 {
445 public:
446 const XMLElement& node;
447 std::string name;
448 std::string switches;
449
450 InvokeFile ( const XMLElement& _node,
451 const std::string& _name );
452
453 void ProcessXML ();
454 };
455
456
457 class Dependency
458 {
459 public:
460 const XMLElement& node;
461 const Module& module;
462 const Module* dependencyModule;
463
464 Dependency ( const XMLElement& _node,
465 const Module& _module );
466
467 void ProcessXML();
468 };
469
470
471 class ImportLibrary
472 {
473 public:
474 const XMLElement& node;
475 const Module& module;
476 std::string basename;
477 std::string definition;
478
479 ImportLibrary ( const XMLElement& _node,
480 const Module& module );
481
482 void ProcessXML ();
483 };
484
485
486 class If
487 {
488 public:
489 const XMLElement& node;
490 const Project& project;
491 const Module* module;
492 const bool negated;
493 std::string property, value;
494 IfableData data;
495
496 If ( const XMLElement& node_,
497 const Project& project_,
498 const Module* module_,
499 const bool negated_ = false );
500 ~If();
501
502 void ProcessXML();
503 };
504
505
506 class CompilerFlag
507 {
508 public:
509 const Project& project;
510 const Module* module;
511 const XMLElement& node;
512 std::string flag;
513
514 CompilerFlag ( const Project& project,
515 const XMLElement& compilerFlagNode );
516 CompilerFlag ( const Project& project,
517 const Module* module,
518 const XMLElement& compilerFlagNode );
519 ~CompilerFlag ();
520 void ProcessXML();
521 private:
522 void Initialize();
523 };
524
525
526 class LinkerFlag
527 {
528 public:
529 const Project& project;
530 const Module* module;
531 const XMLElement& node;
532 std::string flag;
533
534 LinkerFlag ( const Project& project,
535 const XMLElement& linkerFlagNode );
536 LinkerFlag ( const Project& project,
537 const Module* module,
538 const XMLElement& linkerFlagNode );
539 ~LinkerFlag ();
540 void ProcessXML();
541 private:
542 void Initialize();
543 };
544
545
546 class LinkerScript
547 {
548 public:
549 const Project& project;
550 const Module* module;
551 const XMLElement& node;
552 const Module* baseModule;
553 std::string directory;
554 std::string basePath;
555
556 LinkerScript ( const Project& project,
557 const Module* module,
558 const XMLElement& node );
559 ~LinkerScript ();
560 void ProcessXML();
561 };
562
563
564 class Property
565 {
566 public:
567 const XMLElement& node;
568 const Project& project;
569 const Module* module;
570 std::string name, value;
571
572 Property ( const XMLElement& node_,
573 const Project& project_,
574 const Module* module_ );
575
576 void ProcessXML();
577 };
578
579
580 class TestSupportCode
581 {
582 public:
583 const Project& project;
584
585 TestSupportCode ( const Project& project );
586 ~TestSupportCode ();
587 void GenerateTestSupportCode ( bool verbose );
588 private:
589 bool IsTestModule ( const Module& module );
590 void GenerateTestSupportCodeForModule ( Module& module,
591 bool verbose );
592 std::string GetHooksFilename ( Module& module );
593 char* WriteStubbedSymbolToHooksFile ( char* buffer,
594 const StubbedComponent& component,
595 const StubbedSymbol& symbol );
596 char* WriteStubbedComponentToHooksFile ( char* buffer,
597 const StubbedComponent& component );
598 void WriteHooksFile ( Module& module );
599 std::string GetStubsFilename ( Module& module );
600 char* WriteStubbedSymbolToStubsFile ( char* buffer,
601 const StubbedComponent& component,
602 const StubbedSymbol& symbol,
603 int stubIndex );
604 char* WriteStubbedComponentToStubsFile ( char* buffer,
605 const StubbedComponent& component,
606 int* stubIndex );
607 void WriteStubsFile ( Module& module );
608 std::string GetStartupFilename ( Module& module );
609 bool IsUnknownCharacter ( char ch );
610 std::string GetTestDispatcherName ( std::string filename );
611 bool IsTestFile ( std::string& filename ) const;
612 void GetSourceFilenames ( string_list& list,
613 Module& module ) const;
614 char* WriteTestDispatcherPrototypesToStartupFile ( char* buffer,
615 Module& module );
616 char* WriteRegisterTestsFunctionToStartupFile ( char* buffer,
617 Module& module );
618 void WriteStartupFile ( Module& module );
619 };
620
621
622 class WineResource
623 {
624 public:
625 const Project& project;
626 std::string bin2res;
627
628 WineResource ( const Project& project,
629 std::string bin2res );
630 ~WineResource ();
631 void UnpackResources ( bool verbose );
632 private:
633 bool IsSpecFile ( const File& file );
634 bool IsWineModule ( const Module& module );
635 bool IsResourceFile ( const File& file );
636 std::string GetResourceFilename ( const Module& module );
637 void UnpackResourcesInModule ( Module& module,
638 bool verbose );
639 };
640
641
642 class SourceFile
643 {
644 public:
645 SourceFile ( AutomaticDependency* automaticDependency,
646 const Module& module,
647 const std::string& filename,
648 SourceFile* parent,
649 bool isNonAutomaticDependency );
650 SourceFile* ParseFile ( const std::string& normalizedFilename );
651 void Parse ();
652 std::string Location () const;
653 std::vector<SourceFile*> files;
654 AutomaticDependency* automaticDependency;
655 const Module& module;
656 std::string filename;
657 std::string filenamePart;
658 std::string directoryPart;
659 std::vector<SourceFile*> parents; /* List of files, this file is included from */
660 bool isNonAutomaticDependency;
661 std::string cachedDependencies;
662 time_t lastWriteTime;
663 time_t youngestLastWriteTime; /* Youngest last write time of this file and all children */
664 SourceFile* youngestFile;
665 private:
666 void GetDirectoryAndFilenameParts ();
667 void Close ();
668 void Open ();
669 void SkipWhitespace ();
670 bool ReadInclude ( std::string& filename,
671 bool& searchCurrentDirectory,
672 bool& includeNext );
673 bool IsIncludedFrom ( const std::string& normalizedFilename );
674 SourceFile* GetParentSourceFile ();
675 bool CanProcessFile ( const std::string& extension );
676 bool IsParentOf ( const SourceFile* parent,
677 const SourceFile* child );
678 std::string buf;
679 const char *p;
680 const char *end;
681 };
682
683
684 class AutomaticDependency
685 {
686 friend class SourceFileTest;
687 public:
688 const Project& project;
689
690 AutomaticDependency ( const Project& project );
691 ~AutomaticDependency ();
692 std::string GetFilename ( const std::string& filename );
693 bool LocateIncludedFile ( const std::string& directory,
694 const std::string& includedFilename,
695 std::string& resolvedFilename );
696 bool LocateIncludedFile ( SourceFile* sourceFile,
697 const Module& module,
698 const std::string& includedFilename,
699 bool searchCurrentDirectory,
700 bool includeNext,
701 std::string& resolvedFilename );
702 SourceFile* RetrieveFromCacheOrParse ( const Module& module,
703 const std::string& filename,
704 SourceFile* parentSourceFile );
705 SourceFile* RetrieveFromCache ( const std::string& filename );
706 void CheckAutomaticDependencies ( bool verbose );
707 void CheckAutomaticDependenciesForModule ( Module& module,
708 bool verbose );
709 private:
710 void GetModulesToCheck ( Module& module, std::vector<const Module*>& modules );
711 void CheckAutomaticDependencies ( const Module& module,
712 bool verbose );
713 void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );
714 void GetIncludeDirectories ( std::vector<Include*>& includes,
715 const Module& module,
716 Include& currentDirectory,
717 bool searchCurrentDirectory );
718 void GetModuleFiles ( const Module& module,
719 std::vector<File*>& files ) const;
720 void ParseFiles ();
721 void ParseFiles ( const Module& module );
722 void ParseFile ( const Module& module,
723 const File& file );
724 std::map<std::string, SourceFile*> sourcefile_map;
725 };
726
727
728 class Bootstrap
729 {
730 public:
731 const Project& project;
732 const Module* module;
733 const XMLElement& node;
734 std::string base;
735 std::string nameoncd;
736
737 Bootstrap ( const Project& project,
738 const Module* module,
739 const XMLElement& bootstrapNode );
740 ~Bootstrap ();
741 void ProcessXML();
742 private:
743 bool IsSupportedModuleType ( ModuleType type );
744 void Initialize();
745 };
746
747
748 class CDFile
749 {
750 public:
751 const Project& project;
752 const XMLElement& node;
753 std::string name;
754 std::string base;
755 std::string nameoncd;
756 std::string path;
757
758 CDFile ( const Project& project,
759 const XMLElement& bootstrapNode,
760 const std::string& path );
761 ~CDFile ();
762 void ProcessXML();
763 std::string GetPath () const;
764 };
765
766
767 class InstallFile
768 {
769 public:
770 const Project& project;
771 const XMLElement& node;
772 std::string name;
773 std::string base;
774 std::string newname;
775 std::string path;
776
777 InstallFile ( const Project& project,
778 const XMLElement& bootstrapNode,
779 const std::string& path );
780 ~InstallFile ();
781 void ProcessXML ();
782 std::string GetPath () const;
783 };
784
785
786 class PchFile
787 {
788 public:
789 const XMLElement& node;
790 const Module& module;
791 File file;
792
793 PchFile (
794 const XMLElement& node,
795 const Module& module,
796 const File file );
797 void ProcessXML();
798 };
799
800
801 class StubbedComponent
802 {
803 public:
804 const Module* module;
805 const XMLElement& node;
806 std::string name;
807 std::vector<StubbedSymbol*> symbols;
808
809 StubbedComponent ( const Module* module_,
810 const XMLElement& stubbedComponentNode );
811 ~StubbedComponent ();
812 void ProcessXML ();
813 void ProcessXMLSubElement ( const XMLElement& e );
814 };
815
816
817 class StubbedSymbol
818 {
819 public:
820 const XMLElement& node;
821 std::string symbol;
822 std::string newname;
823 std::string strippedName;
824
825 StubbedSymbol ( const XMLElement& stubbedSymbolNode );
826 ~StubbedSymbol ();
827 void ProcessXML();
828 private:
829 std::string StripSymbol ( std::string symbol );
830 };
831
832
833 class CompilationUnit
834 {
835 public:
836 const Project* project;
837 const Module* module;
838 const XMLElement* node;
839 std::string name;
840 std::vector<File*> files;
841
842 CompilationUnit ( File* file );
843 CompilationUnit ( const Project* project,
844 const Module* module,
845 const XMLElement* node );
846 ~CompilationUnit ();
847 void ProcessXML();
848 bool IsGeneratedFile () const;
849 bool HasFileWithExtension ( const std::string& extension ) const;
850 bool IsFirstFile () const;
851 FileLocation* GetFilename ( Directory* intermediateDirectory ) const;
852 std::string GetSwitches () const;
853 };
854
855
856 class CompilationUnitSupportCode
857 {
858 public:
859 const Project& project;
860
861 CompilationUnitSupportCode ( const Project& project );
862 ~CompilationUnitSupportCode ();
863 void Generate ( bool verbose );
864 private:
865 void GenerateForModule ( Module& module,
866 bool verbose );
867 std::string GetCompilationUnitFilename ( Module& module,
868 CompilationUnit& compilationUnit );
869 void WriteCompilationUnitFile ( Module& module,
870 CompilationUnit& compilationUnit );
871 };
872
873
874 class FileLocation
875 {
876 public:
877 Directory* directory;
878 std::string filename;
879 FileLocation ( Directory* directory,
880 std::string filename );
881 };
882
883
884 enum AutoRegisterType
885 {
886 DllRegisterServer,
887 DllInstall,
888 Both
889 };
890
891 class AutoRegister
892 {
893 public:
894 const Project& project;
895 const Module* module;
896 const XMLElement& node;
897 std::string infSection;
898 AutoRegisterType type;
899 AutoRegister ( const Project& project_,
900 const Module* module_,
901 const XMLElement& node_ );
902 ~AutoRegister ();
903 void ProcessXML();
904 private:
905 bool IsSupportedModuleType ( ModuleType type );
906 AutoRegisterType GetAutoRegisterType( std::string type );
907 void Initialize ();
908 };
909
910
911 class SysSetupGenerator
912 {
913 public:
914 const Project& project;
915 SysSetupGenerator ( const Project& project );
916 ~SysSetupGenerator ();
917 void Generate ();
918 private:
919 std::string GetDirectoryId ( const Module& module );
920 std::string GetFlags ( const Module& module );
921 void Generate ( HINF inf,
922 const Module& module );
923 };
924
925
926 extern void
927 InitializeEnvironment ();
928
929 extern std::string
930 Right ( const std::string& s, size_t n );
931
932 extern std::string
933 Replace ( const std::string& s, const std::string& find, const std::string& with );
934
935 extern std::string
936 ChangeSeparator ( const std::string& s,
937 const char fromSeparator,
938 const char toSeparator );
939
940 extern std::string
941 FixSeparator ( const std::string& s );
942
943 extern std::string
944 FixSeparatorForSystemCommand ( const std::string& s );
945
946 extern std::string
947 DosSeparator ( const std::string& s );
948
949 extern std::string
950 ReplaceExtension (
951 const std::string& filename,
952 const std::string& newExtension );
953
954 extern std::string
955 GetSubPath (
956 const std::string& location,
957 const std::string& path,
958 const std::string& att_value );
959
960 extern std::string
961 GetExtension ( const std::string& filename );
962
963 extern std::string
964 GetDirectory ( const std::string& filename );
965
966 extern std::string
967 GetFilename ( const std::string& filename );
968
969 extern std::string
970 NormalizeFilename ( const std::string& filename );
971
972 extern std::string
973 ToLower ( std::string filename );
974
975 #endif /* __RBUILD_H */