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