Explorar o código

Inno Setup Preprocessor (ISPP) change: Added new UpperCase support function.

Martijn Laan %!s(int64=5) %!d(string=hai) anos
pai
achega
ed53ab689f
Modificáronse 3 ficheiros con 27 adicións e 0 borrados
  1. 9 0
      Projects/ISPP/Help/ispp.xml
  2. 17 0
      Projects/ISPP/IsppFuncs.pas
  3. 1 0
      whatsnew.htm

+ 9 - 0
Projects/ISPP/Help/ispp.xml

@@ -922,6 +922,15 @@ The list of options is provided at the end of this topic.</para>
 					<para>Returns a string with the same text as the string passed in its parameter, but with all letters converted to lowercase. The conversion affects only 7-bit ASCII characters between 'A' and 'Z'.</para>
 				</description>
 			</topic>
+			<topic id="UpperCase">
+				<title>UpperCase</title>
+				<section title="Prototype">
+					<pre><line><b>str</b> UpperCase(<b>str</b>)</line></pre>
+				</section>
+				<description>
+					<para>Returns a string with the same text as the string passed in its parameter, but with all letters converted to uppercase. The conversion affects only 7-bit ASCII characters between 'A' and 'Z'.</para>
+				</description>
+			</topic>
 			<topic id="EntryCount">
 				<title>EntryCount</title>
 				<section title="Prototype">

+ 17 - 0
Projects/ISPP/IsppFuncs.pas

@@ -820,6 +820,22 @@ begin
   end;
 end;
 
+function UpperCaseFunc(Ext: Longint; const Params: IIsppFuncParams;
+  const FuncResult: IIsppFuncResult): TIsppFuncResult; stdcall;
+begin
+  if CheckParams(Params, [evStr], 1, Result) then
+  try
+    with IInternalFuncParams(Params) do
+      MakeStr(ResPtr^, UpperCase(Get(0).AsStr));
+  except
+    on E: Exception do
+    begin
+      FuncResult.Error(PChar(E.Message));
+      Result.Error := ISPPFUNC_FAIL
+    end;
+  end;
+end;
+
 function RPosFunc(Ext: Longint; const Params: IIsppFuncParams;
   const FuncResult: IIsppFuncResult): TIsppFuncResult; stdcall;
 
@@ -1720,6 +1736,7 @@ begin
     RegisterFunction('SetupSetting', SetupSetting, -1);
     RegisterFunction('SetSetupSetting', SetSetupSetting, -1);
     RegisterFunction('LowerCase', LowerCaseFunc, -1);
+    RegisterFunction('UpperCase', UpperCaseFunc, -1);
     RegisterFunction('EntryCount', EntryCountFunc, -1);
     RegisterFunction('GetEnv', GetEnvFunc, -1);
     RegisterFunction('DeleteFile', DelFileFunc, -1);

+ 1 - 0
whatsnew.htm

@@ -30,6 +30,7 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
 <ul>
   <li>Added new constant: <tt>{usersavedgames}</tt>.</li>
   <li>[Setup] section directives <tt>LicenseFile</tt>, <tt>InfoBeforeFile</tt> and <tt>InfoAfterFile</tt> now support objects such as images in .rtf (rich text) files.</li>
+  <li>Inno Setup Preprocessor (ISPP) change: Added new <tt>UpperCase</tt> support function.</li>
   <li><i>Fix:</i> Event attributes for uninstall event functions now actually work.</li>
   <li>Minor tweaks.</li>
 </ul>