瀏覽代碼

Fix CopyFile/FileCopy discrepancy between [Code] and ISPP.

Martijn Laan 1 年之前
父節點
當前提交
6142142d1b
共有 4 個文件被更改,包括 18 次插入10 次删除
  1. 7 3
      Files/ISPPBuiltins.iss
  2. 4 4
      ISHelp/ispp.xml
  3. 2 2
      Projects/Src/ISPP.Funcs.pas
  4. 5 1
      whatsnew.htm

+ 7 - 3
Files/ISPPBuiltins.iss

@@ -302,17 +302,21 @@
 #define SameStr(str S1, str S2) \
 #define SameStr(str S1, str S2) \
   S1 == S2
   S1 == S2
 
 
-#define WarnRenamedVersion(str OldName, str NewName) \
+#define WarnRenamed(str OldName, str NewName) \
   Warning("Function """ + OldName + """ has been renamed. Use """ + NewName + """ instead.")
   Warning("Function """ + OldName + """ has been renamed. Use """ + NewName + """ instead.")
 
 
 #define ParseVersion(str FileName, *Major, *Minor, *Rev, *Build) \
 #define ParseVersion(str FileName, *Major, *Minor, *Rev, *Build) \
-  WarnRenamedVersion("ParseVersion", "GetVersionComponents"), \
+  WarnRenamed("ParseVersion", "GetVersionComponents"), \
   GetVersionComponents(FileName, Major, Minor, Rev, Build)
   GetVersionComponents(FileName, Major, Minor, Rev, Build)
 
 
 #define GetFileVersion(str FileName) \
 #define GetFileVersion(str FileName) \
-  WarnRenamedVersion("GetFileVersion", "GetVersionNumbersString"), \
+  WarnRenamed("GetFileVersion", "GetVersionNumbersString"), \
   GetVersionNumbersString(FileName)
   GetVersionNumbersString(FileName)
 
 
+#define CopyFile(str ExistingFile, str NewFile) \
+  WarnRenamed("CopyFile", "FileCopy"), \
+  FileCopy(ExistingFile, NewFile)
+
 #ifdef DisablePOptP
 #ifdef DisablePOptP
 # pragma parseroption -p-
 # pragma parseroption -p-
 #endif
 #endif

+ 4 - 4
ISHelp/ispp.xml

@@ -1000,13 +1000,13 @@ The first group of options (<tt>option</tt>) controls the general options, while
 					<p>Deletes the specified file. Does not return anything. Also see <tt><link href="DeleteFile">DeleteFile</link></tt>.</p>
 					<p>Deletes the specified file. Does not return anything. Also see <tt><link href="DeleteFile">DeleteFile</link></tt>.</p>
 				</description>
 				</description>
 			</topic>
 			</topic>
-			<topic id="CopyFile">
-				<title>CopyFile</title>
+			<topic id="FileCopy">
+				<title>FileCopy</title>
 				<section title="Prototype">
 				<section title="Prototype">
-					<pre><line><b>void</b> CopyFile(<b>str</b> 1, <b>str</b> 2)</line></pre>
+					<pre><line><b>void</b> FileCopy(<b>str</b> ExistingFile, <b>str</b> NewFile)</line></pre>
 				</section>
 				</section>
 				<description>
 				<description>
-					<p>Copies an existing file (first parameter) to a new file (second parameter). If the new file already exists, it will be overwritten.</p>
+					<p>Copies ExistingFile to NewFile, preserving time stamp and file attributes. If NewFile already exists, it will be overwritten.</p>
 				</description>
 				</description>
 			</topic>
 			</topic>
 			<topic id="FindFirst">
 			<topic id="FindFirst">

+ 2 - 2
Projects/Src/ISPP.Funcs.pas

@@ -1147,7 +1147,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function CopyFileFunc(Ext: Longint; const Params: IIsppFuncParams;
+function FileCopyFunc(Ext: Longint; const Params: IIsppFuncParams;
   const FuncResult: IIsppFuncResult): TIsppFuncResult; stdcall;
   const FuncResult: IIsppFuncResult): TIsppFuncResult; stdcall;
 begin
 begin
   if CheckParams(Params, [evStr, evStr], 2, Result) then
   if CheckParams(Params, [evStr, evStr], 2, Result) then
@@ -2045,7 +2045,7 @@ begin
     RegisterFunction('GetEnv', GetEnvFunc, -1);
     RegisterFunction('GetEnv', GetEnvFunc, -1);
     RegisterFunction('DeleteFile', DelFileFunc, -1);
     RegisterFunction('DeleteFile', DelFileFunc, -1);
     RegisterFunction('DeleteFileNow', DelFileNowFunc, -1);
     RegisterFunction('DeleteFileNow', DelFileNowFunc, -1);
-    RegisterFunction('CopyFile', CopyFileFunc, -1);
+    RegisterFunction('FileCopy', FileCopyFunc, -1);
     RegisterFunction('ReadEnv', GetEnvFunc, -1);
     RegisterFunction('ReadEnv', GetEnvFunc, -1);
     RegisterFunction('FindFirst', FindFirstFunc, -1);
     RegisterFunction('FindFirst', FindFirstFunc, -1);
     RegisterFunction('FindNext', FindNextFunc, -1);
     RegisterFunction('FindNext', FindNextFunc, -1);

+ 5 - 1
whatsnew.htm

@@ -91,7 +91,11 @@ For conditions of distribution and use, see <a href="files/is/license.txt">LICEN
     <li>Documented support functions <tt>VarArrayGet</tt> and <tt>VarArraySet</tt> which were already available but not documented.</li>
     <li>Documented support functions <tt>VarArrayGet</tt> and <tt>VarArraySet</tt> which were already available but not documented.</li>
   </ul>
   </ul>
   </li>
   </li>
-  <li>ISPP change: Added support functions <tt>GetSHA256OfFile</tt>, <tt>GetSHA256OfString</tt>, and <tt>GetSHA256OfUnicodeString</tt>.</li>
+  <li>ISPP changes:
+    <ul>
+      <li>Added support functions <tt>GetSHA256OfFile</tt>, <tt>GetSHA256OfString</tt>, and <tt>GetSHA256OfUnicodeString</tt>.</li>
+      <li>Support function <tt>CopyFile</tt> has been renamed to <tt>FileCopy</tt>. The old name is still supported, but it is recommended to update your scripts to the new name and the compiler will issue a warning if you don't.</li>
+    </ul>
   <li>Various tweaks and other documentation improvements.</li>
   <li>Various tweaks and other documentation improvements.</li>
 </ul>
 </ul>