Browse Source

Improve handling of renamed functions.

Martijn Laan 5 years ago
parent
commit
e4fe3aef45
2 changed files with 10 additions and 20 deletions
  1. 10 4
      Files/ISPPBuiltins.iss
  2. 0 16
      Projects/ISPP/IsppFuncs.pas

+ 10 - 4
Files/ISPPBuiltins.iss

@@ -168,10 +168,6 @@
     Build   = Int(Local[1]), \
   Local[0])
 //
-#define ParseVersion(str FileName, *Major, *Minor, *Rev, *Build) \
-  Warning("Function ""ParseVersion"" has been renamed. Use ""GetVersionComponents"" instead."), \
-  GetVersionComponents(FileName, Major, Minor, Rev, Build)
-//
 #define GetPackedVersion(str FileName, *Version) \
   Local[0] = GetVersionComponents(FileName, Local[1], Local[2], Local[3], Local[4]), \
   Version = PackVersionComponents(Local[1], Local[2], Local[3], Local[4]), \
@@ -308,6 +304,16 @@
 #define SameStr(str S1, str S2) \
   S1 == S2
 //
+#define WarnRenamedVersion(str OldName, str NewName) \
+  Warning("Function """ + OldName + """ has been renamed. Use """ + NewName + "GetVersionComponents"" instead.")
+//
+#define ParseVersion(str FileName, *Major, *Minor, *Rev, *Build) \
+  WarnRenamedVersion("ParseVersion", "GetVersionComponents"), \
+  GetVersionComponents(FileName, Major, Minor, Rev, Build)
+//
+#define GetFileVersion(str FileName) \
+  WarnRenamedVersion("GetFileVersion", "GetVersionNumbersString"), \
+  GetVersionNumbersString(FileName)
 //
 #ifdef CStrings
 # pragma parseroption -p-

+ 0 - 16
Projects/ISPP/IsppFuncs.pas

@@ -923,21 +923,6 @@ begin
   end;
 end;
 
-function GetFileVersionFunc(Ext: Longint; const Params: IIsppFuncParams;
-  const FuncResult: IIsppFuncResult): TIsppFuncResult; stdcall;
-begin
-  try
-    TPreprocessor(Ext).Warning('Function "%s" has been renamed. Use "%s" instead.', ['GetFileVersion', 'GetVersionNumbersString']);
-    Result := GetVersionNumbersStringFunc(Ext, Params, FuncResult);
-  except
-    on E: Exception do
-    begin
-      FuncResult.Error(PChar(E.Message));
-      Result.Error := ISPPFUNC_FAIL
-    end;
-  end;
-end;
-
 function ComparePackedVersionFunc(Ext: Longint; const Params: IIsppFuncParams;
   const FuncResult: IIsppFuncResult): TIsppFuncResult; stdcall;
 begin
@@ -1864,7 +1849,6 @@ begin
     RegisterFunction('RPos', RPosFunc, -1);
     RegisterFunction('Len', LenFunc, -1);
     RegisterFunction('GetVersionNumbersString', GetVersionNumbersStringFunc, -1);
-    RegisterFunction('GetFileVersion', GetFileVersionFunc, -1);
     RegisterFunction('ComparePackedVersion', ComparePackedVersionFunc, -1);
     RegisterFunction('SamePackedVersion', SamePackedVersionFunc, -1);
     RegisterFunction('GetStringFileInfo', GetFileVersionInfoItem, -1);