소스 검색

[Types] and [Components] Check is special compared to others: it's called only once. Clarify this, at least internally and in the docs.

Martijn Laan 2 달 전
부모
커밋
567972d993
4개의 변경된 파일11개의 추가작업 그리고 11개의 파일을 삭제
  1. 2 2
      ISHelp/isx.xml
  2. 5 5
      Projects/Src/Compiler.SetupCompiler.pas
  3. 2 2
      Projects/Src/Setup.MainFunc.pas
  4. 2 2
      Projects/Src/Shared.Struct.pas

+ 2 - 2
ISHelp/isx.xml

@@ -411,13 +411,13 @@ Source: "B\MYFILE.TXT"; DestDir: "{app}"; Check: DirExists(ExpandConstant('{app}
 
 <p>All check functions must have a Boolean return value. If a check function (or the boolean expression) returns True, the entry is processed otherwise it's skipped.</p>
 
-<p>Setup might call each check function several times, even if there's only one entry that uses the check function. If your function performs a lengthy piece of code, you can optimize it by performing the code only once and 'caching' the result in a global variable.</p>
+<p>For all sections except [Types] and [Components], Setup might call each check function several times, even if there's only one entry that uses the check function. If your function performs a lengthy piece of code, you can optimize it by performing the code only once and 'caching' the result in a global variable.</p>
 
 <p>A check function isn't called if Setup already determined the entry shouldn't be processed.</p>
 
 <p>A check function for a [Files] section entry using a wildcard but not the <tt>external</tt> flag is called once per file matching the wildcard, instead of once per entry. Use <tt>CurrentFileName</tt> to check for which file the function is called.</p>
 
-<p>Here is an example of a <tt>[Code]</tt> section containing the check functions used above. Function <tt>DirExists</tt> is a <link topic="scriptfunctions">support function</link> and therefore not included in this [Code] section.</p>
+<p>Here is an example of a [Code] section containing the check functions used above. Function <tt>DirExists</tt> is a <link topic="scriptfunctions">support function</link> and therefore not included in this [Code] section.</p>
 
 <precode>
 [Code]

+ 5 - 5
Projects/Src/Compiler.SetupCompiler.pas

@@ -3481,7 +3481,7 @@ begin
 
       { Common parameters }
       ProcessExpressionParameter(ParamCommonLanguages, Values[paLanguages].Data, EvalLanguageIdentifier, False, Languages);
-      Check := Values[paCheck].Data;
+      CheckOnce := Values[paCheck].Data;
       ProcessMinVersionParameter(Values[paMinVersion], MinVersion);
       ProcessOnlyBelowVersionParameter(Values[paOnlyBelowVersion], OnlyBelowVersion);
 
@@ -3489,7 +3489,7 @@ begin
         AbortCompile(SCompilerTypesCustomTypeAlreadyDefined);
 
       CheckConst(Description, MinVersion, []);
-      CheckCheckOrInstall(ParamCommonCheck, Check, cikCheck);
+      CheckCheckOrInstall(ParamCommonCheck, CheckOnce, cikCheck);
     end;
   except
     SEFreeRec(NewTypeEntry, SetupTypeEntryStrings, SetupTypeEntryAnsiStrings);
@@ -3592,7 +3592,7 @@ begin
 
       { Common parameters }
       ProcessExpressionParameter(ParamCommonLanguages, Values[paLanguages].Data, EvalLanguageIdentifier, False, Languages);
-      Check := Values[paCheck].Data;
+      CheckOnce := Values[paCheck].Data;
       ProcessMinVersionParameter(Values[paMinVersion], MinVersion);
       ProcessOnlyBelowVersionParameter(Values[paOnlyBelowVersion], OnlyBelowVersion);
 
@@ -3601,7 +3601,7 @@ begin
           [ParamCommonFlags, 'dontinheritcheck', 'exclusive']);
 
       CheckConst(Description, MinVersion, []);
-      CheckCheckOrInstall(ParamCommonCheck, Check, cikCheck);
+      CheckCheckOrInstall(ParamCommonCheck, CheckOnce, cikCheck);
     end;
   except
     SEFreeRec(NewComponentEntry, SetupComponentEntryStrings, SetupComponentEntryAnsiStrings);
@@ -7395,7 +7395,7 @@ var
     NewTypeEntry := AllocMem(SizeOf(TSetupTypeEntry));
     NewTypeEntry.Name := Name;
     NewTypeEntry.Description := ''; //set at runtime
-    NewTypeEntry.Check := '';
+    NewTypeEntry.CheckOnce := '';
     NewTypeEntry.MinVersion := SetupHeader.MinVersion;
     NewTypeEntry.OnlyBelowVersion := SetupHeader.OnlyBelowVersion;
     NewTypeEntry.Options := Options;

+ 2 - 2
Projects/Src/Setup.MainFunc.pas

@@ -3357,7 +3357,7 @@ begin
   { Remove types that fail their 'languages' or 'check'. Can't do this earlier
     because the InitializeSetup call above can't be done earlier. }
   for I := 0 to Entries[seType].Count-1 do begin
-    if not ShouldProcessEntry(nil, nil, '', '', PSetupTypeEntry(Entries[seType][I]).Languages, PSetupTypeEntry(Entries[seType][I]).Check) then begin
+    if not ShouldProcessEntry(nil, nil, '', '', PSetupTypeEntry(Entries[seType][I]).Languages, PSetupTypeEntry(Entries[seType][I]).CheckOnce) then begin
       SEFreeRec(Entries[seType][I], EntryStrings[seType], EntryAnsiStrings[seType]);
       { Don't delete it yet so that the entries can be processed sequentially }
       Entries[seType][I] := nil;
@@ -3373,7 +3373,7 @@ begin
     ComponentEntry := PSetupComponentEntry(Entries[seComponent][I]);
     if (ComponentEntry.Level <= NextAllowedLevel) and
        (InstallOnThisVersion(ComponentEntry.MinVersion, ComponentEntry.OnlyBelowVersion) = irInstall) and
-       ShouldProcessEntry(nil, nil, '', '', ComponentEntry.Languages, ComponentEntry.Check) then begin
+       ShouldProcessEntry(nil, nil, '', '', ComponentEntry.Languages, ComponentEntry.CheckOnce) then begin
       NextAllowedLevel := ComponentEntry.Level + 1;
       LastShownComponentEntry := ComponentEntry;
     end

+ 2 - 2
Projects/Src/Shared.Struct.pas

@@ -168,7 +168,7 @@ type
   TSetupTypeType = (ttUser, ttDefaultFull, ttDefaultCompact, ttDefaultCustom);
   PSetupTypeEntry = ^TSetupTypeEntry;
   TSetupTypeEntry = packed record
-    Name, Description, Languages, Check: String;
+    Name, Description, Languages, CheckOnce: String;
     MinVersion, OnlyBelowVersion: TSetupVersionData;
     Options: TSetupTypeOptions;
     Typ: TSetupTypeType;
@@ -181,7 +181,7 @@ const
 type
   PSetupComponentEntry = ^TSetupComponentEntry;
   TSetupComponentEntry = packed record
-    Name, Description, Types, Languages, Check: String;
+    Name, Description, Types, Languages, CheckOnce: String;
     ExtraDiskSpaceRequired: Integer64;
     Level: Integer;
     Used: Boolean;