Просмотр исходного кода

ppremake 1.20, introducing #output

David Rose 19 лет назад
Родитель
Сommit
4062b2c939

+ 1 - 1
ppremake/config_msvc.h

@@ -86,5 +86,5 @@
  **         Also be sure to change the version number        **
  **             at the beginning of configure.in.            **
  ****************                              ****************/
-#define VERSION "1.19"
+#define VERSION "1.20"
 /****************  UPDATE VERSION NUMBER HERE  ****************/

+ 1 - 1
ppremake/configure.in

@@ -5,7 +5,7 @@ dnl ****************  UPDATE VERSION NUMBER HERE  ****************
 dnl **         Also be sure to change the version number        **
 dnl **                at the end of config_msvc.h.              **
 dnl ****************                              ****************
-AM_INIT_AUTOMAKE(ppremake, 1.19)
+AM_INIT_AUTOMAKE(ppremake, 1.20)
 dnl ****************  UPDATE VERSION NUMBER HERE  ****************
 
 AM_CONFIG_HEADER(config.h)

+ 53 - 0
ppremake/ppCommandFile.cxx

@@ -665,6 +665,9 @@ handle_command(const string &line) {
   } else if (_command == "sinclude") {
     return handle_sinclude_command();
 
+  } else if (_command == "copy") {
+    return handle_copy_command();
+
   } else if (_command == "call") {
     return handle_call_command();
 
@@ -1404,6 +1407,56 @@ handle_sinclude_command() {
   return include_file(filename);
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: PPCommandFile::handle_copy_command
+//       Access: Protected
+//  Description: Handles the #copy command: the indicated file is
+//               read and output at this point.  This is useful for
+//               inserting within an #output sequence, to copy the
+//               contents of some file into the target file.
+////////////////////////////////////////////////////////////////////
+bool PPCommandFile::
+handle_copy_command() {
+  string filename = trim_blanks(_scope->expand_string(_params));
+
+  // We allow optional quotation marks around the filename.
+  if (filename.length() >= 2 &&
+      filename[0] == '"' && 
+      filename[filename.length() - 1] == '"') {
+    filename = filename.substr(1, filename.length() - 2);
+  }
+
+  Filename fn(filename);
+  fn.set_text();
+
+  ifstream in;
+  if (!fn.open_read(in)) {
+    cerr << "Unable to open copy file " << fn << ".\n";
+    errors_occurred = true;
+    return false;
+  }
+  if (verbose) {
+    cerr << "Reading (copy) \"" << fn << "\"\n";
+  }
+
+  string line;
+  getline(in, line);
+  while (!in.fail() && !in.eof()) {
+    if (!_write_state->write_line(line)) {
+      return false;
+    }
+    getline(in, line);
+  }
+
+  if (!in.eof()) {
+    cerr << "Error reading " << fn << ".\n";
+    errors_occurred = true;
+    return false;
+  }
+
+  return true;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: PPCommandFile::handle_call_command
 //       Access: Protected

+ 1 - 0
ppremake/ppCommandFile.h

@@ -59,6 +59,7 @@ protected:
   bool handle_printvar_command();
   bool handle_include_command();
   bool handle_sinclude_command();
+  bool handle_copy_command();
   bool handle_call_command();
   bool handle_error_command();
   bool handle_mkdir_command();

+ 5 - 2
ppremake/ppDirectory.cxx

@@ -10,6 +10,7 @@
 #include "ppCommandFile.h"
 #include "ppDependableFile.h"
 #include "tokenize.h"
+#include "ppremake.h"
 
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
@@ -365,9 +366,10 @@ get_dependable_file(const string &filename, bool is_header) {
       if (_tree != main_tree &&
           other->get_directory()->get_tree() != main_tree) {
         // Both files are in external dependable trees.
-        cerr << "Warning: header file " << dependable->get_fullpath()
+        cerr << "Error: header file " << dependable->get_fullpath()
              << " may be confused with " << other->get_fullpath()
              << ".\n";
+        errors_occurred = true;
 
       } else if (other->get_directory()->get_tree() != _tree) {
         // This file is a source file in this tree, while the other
@@ -377,9 +379,10 @@ get_dependable_file(const string &filename, bool is_header) {
 
       } else {
         // Both files are within the same source tree.
-        cerr << "Warning: source file " << dependable->get_pathname()
+        cerr << "Error: source file " << dependable->get_pathname()
              << " may be confused with " << other->get_pathname()
              << ".\n";
+        errors_occurred = true;
       }
     }
   }

+ 5 - 5
ppremake/ppremake.sln

@@ -1,12 +1,12 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
+Microsoft Visual Studio Solution File, Format Version 8.00
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ppremake", "ppremake.vcproj", "{B2B6A5F5-4403-4386-9294-B10EE8B0B3E8}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
 EndProject
 Global
 	GlobalSection(SolutionConfiguration) = preSolution
-		ConfigName.0 = Debug
-		ConfigName.1 = Release
-	EndGlobalSection
-	GlobalSection(ProjectDependencies) = postSolution
+		Debug = Debug
+		Release = Release
 	EndGlobalSection
 	GlobalSection(ProjectConfiguration) = postSolution
 		{B2B6A5F5-4403-4386-9294-B10EE8B0B3E8}.Debug.ActiveCfg = Debug|Win32

+ 32 - 18
ppremake/ppremake.vcproj

@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
+<?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="7.00"
+	Version="7.10"
 	Name="ppremake"
 	ProjectGUID="{B2B6A5F5-4403-4386-9294-B10EE8B0B3E8}"
 	Keyword="CustomAppWizProj">
@@ -32,8 +32,14 @@
 				Name="VCResourceCompilerTool"/>
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
 			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
@@ -57,10 +63,18 @@
 				Name="VCResourceCompilerTool"/>
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
 			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 	</Configurations>
+	<References>
+	</References>
 	<Files>
 		<Filter
 			Name="Template Files"
@@ -87,9 +101,6 @@
 		<Filter
 			Name="Miscellaneous Files"
 			Filter="vsz;vsdir;ico;vcproj;csproj;css;inf">
-			<File
-				RelativePath="Templates\1033\Templates.inf">
-			</File>
 			<File
 				RelativePath="default.vcproj">
 			</File>
@@ -102,6 +113,9 @@
 			<File
 				RelativePath="ppremake.vsz">
 			</File>
+			<File
+				RelativePath="Templates\1033\Templates.inf">
+			</File>
 		</Filter>
 		<File
 			RelativePath="check_include.cxx">
@@ -112,9 +126,6 @@
 		<File
 			RelativePath="config_msvc.h">
 		</File>
-		<File
-			RelativePath="dSearchPath.I">
-		</File>
 		<File
 			RelativePath="dSearchPath.cxx">
 		</File>
@@ -122,13 +133,13 @@
 			RelativePath="dSearchPath.h">
 		</File>
 		<File
-			RelativePath="executionEnvironment.cxx">
+			RelativePath="dSearchPath.I">
 		</File>
 		<File
-			RelativePath="executionEnvironment.h">
+			RelativePath="executionEnvironment.cxx">
 		</File>
 		<File
-			RelativePath="filename.I">
+			RelativePath="executionEnvironment.h">
 		</File>
 		<File
 			RelativePath="filename.cxx">
@@ -137,7 +148,7 @@
 			RelativePath="filename.h">
 		</File>
 		<File
-			RelativePath="globPattern.I">
+			RelativePath="filename.I">
 		</File>
 		<File
 			RelativePath="globPattern.cxx">
@@ -145,6 +156,9 @@
 		<File
 			RelativePath="globPattern.h">
 		</File>
+		<File
+			RelativePath="globPattern.I">
+		</File>
 		<File
 			RelativePath="gnu_getopt.c">
 		</File>
@@ -206,22 +220,22 @@
 			RelativePath="ppNamedScopes.h">
 		</File>
 		<File
-			RelativePath="ppScope.cxx">
+			RelativePath="ppremake.cxx">
 		</File>
 		<File
-			RelativePath="ppScope.h">
+			RelativePath="ppremake.h">
 		</File>
 		<File
-			RelativePath="ppSubroutine.cxx">
+			RelativePath="ppScope.cxx">
 		</File>
 		<File
-			RelativePath="ppSubroutine.h">
+			RelativePath="ppScope.h">
 		</File>
 		<File
-			RelativePath="ppremake.cxx">
+			RelativePath="ppSubroutine.cxx">
 		</File>
 		<File
-			RelativePath="ppremake.h">
+			RelativePath="ppSubroutine.h">
 		</File>
 		<File
 			RelativePath="sedAddress.cxx">