浏览代码

Fix: Support function SameStr is now properly case-sensitive. Has 'always' been buggy.

Martijn Laan 5 天之前
父节点
当前提交
f2200d958d
共有 4 个文件被更改,包括 21 次插入5 次删除
  1. 0 3
      Files/ISPPBuiltins.iss
  2. 0 1
      ISHelp/ispp.xml
  3. 20 1
      Projects/Src/ISPP.Funcs.pas
  4. 1 0
      whatsnew.htm

+ 0 - 3
Files/ISPPBuiltins.iss

@@ -298,9 +298,6 @@
 #define SameText(str S1, str S2) \
   S1 == S2
 
-#define SameStr(str S1, str S2) \
-  S1 == S2
-
 #define WarnRenamedVersion(str OldName, str NewName) \
   Warning("Function """ + OldName + """ has been renamed. Use """ + NewName + """ instead.")
 

+ 0 - 1
ISHelp/ispp.xml

@@ -1846,7 +1846,6 @@ The first group of options (<tt>option</tt>) controls the general options, while
 				</section>
 				<description>
 					<p>Returns True if the given strings are identical, with case-sensitivity.</p>
-          <p>Declared in &builtins;.</p>
 				</description>
 			</topic>
 			<topic id="Message">

+ 20 - 1
Projects/Src/ISPP.Funcs.pas

@@ -2000,6 +2000,24 @@ begin
   end;
 end;
 
+function SameStrFunc(Ext: NativeInt; const Params: IIsppFuncParams;
+  const FuncResult: IIsppFuncResult): TIsppFuncResult; stdcall;
+begin
+  if CheckParams(Params, [evStr, evStr], 2, Result) then
+  try
+    with IInternalFuncParams(Params) do
+    begin
+      MakeBool(ResPtr^, SameStr(Get(0).AsStr, Get(1).AsStr));
+    end;
+  except
+    on E: Exception do
+    begin
+      FuncResult.Error(PChar(E.Message));
+      Result.Error := ISPPFUNC_FAIL
+    end;
+  end;
+end;
+
 procedure RegisterFunctions(Preproc: TPreprocessor);
 begin
   with Preproc do
@@ -2068,7 +2086,8 @@ begin
     RegisterFunction('Message', MessageFunc, -1);
     RegisterFunction('Warning', WarningFunc, -1);
     RegisterFunction('Error', ErrorFunc, -1);
-    RegisterFunction('AddQuotes', AddQuotesFunc, -1)
+    RegisterFunction('AddQuotes', AddQuotesFunc, -1);
+    RegisterFunction('SameStr', SameStrFunc, -1)
   end;
 end;
 

+ 1 - 0
whatsnew.htm

@@ -133,6 +133,7 @@ For conditions of distribution and use, see <a href="files/is/license.txt">LICEN
   </li>
   <li>ISPP:
   <ul>
+    <li><i>Fix:</i> Support function <tt>SameStr</tt> is now properly case-sensitive.</li>
     <li>Using support function <tt>ExtractFileDir</tt> no longer triggers a warning about <tt>RemoveBackslash</tt>.</li>
   </ul>
   </li>