@@ -202,7 +202,7 @@ THtmlTemplateParserBreaker = class(THtmlTemplateParser)
202202 procedure parseHTMLSimple (const data: IData);
203203 procedure closeVariableLog ;
204204
205- procedure parseDoc (sender: TXQueryEngine; html,uri,contenttype: string; var node: TTreeNode);
205+ procedure parseDoc ({ %H- } sender: TXQueryEngine; html,uri,contenttype: string; var node: TTreeNode);
206206end ;
207207
208208 { TTemplateReaderBreaker }
@@ -212,7 +212,7 @@ TTemplateReaderBreaker = class(TMultipageTemplateReader)
212212 destructor destroy(); override;
213213 procedure setTemplate (atemplate: TMultiPageTemplate);
214214 procedure perform (actions: TStringArray);
215- procedure selfLog (sender: TMultipageTemplateReader; logged: string; debugLevel: integer);
215+ procedure selfLog ({ %H- } sender: TMultipageTemplateReader; logged: string; debugLevel: integer);
216216
217217 end ;
218218
@@ -263,7 +263,6 @@ procedure setTerminalColor(err: boolean; color: TMyConsoleColors);
263263function setTextEncoding (var t: TextFile; e: string): integer;
264264var
265265 codepage: Integer;
266- str: String;
267266begin
268267 codepage := strEncodingFromName(e);
269268 if codepage = CP_NONE then begin
@@ -753,7 +752,7 @@ TDirectDataRequest = class(TFollowTo)
753752 data: string;
754753 constructor create(adata: string);
755754 function clone : TFollowTo; override;
756- function retrieve (parent: TProcessingContext; arecursionLevel: integer): IData; override;
755+ function retrieve ({ %H- } parent: TProcessingContext; arecursionLevel: integer): IData; override;
757756 function equalTo (ft: TFollowTo): boolean; override;
758757 // procedure replaceVariables; do not replace vars in direct data
759758end ;
@@ -762,7 +761,7 @@ TDirectDataRequest = class(TFollowTo)
762761
763762TStdinDataRequest = class (TFollowTo)
764763 function clone : TFollowTo; override;
765- function retrieve (parent: TProcessingContext; arecursionLevel: integer): IData; override;
764+ function retrieve ({ %H- } parent: TProcessingContext; arecursionLevel: integer): IData; override;
766765 function equalTo (ft: TFollowTo): boolean; override;
767766end ;
768767
@@ -772,7 +771,7 @@ TFollowToProcessedData = class(TFollowTo)
772771 data: IData;
773772 constructor create(d: IData);
774773 function clone : TFollowTo; override;
775- function retrieve (parent: TProcessingContext; arecursionLevel: integer): IData; override;
774+ function retrieve ({ %H- } parent: TProcessingContext; arecursionLevel: integer): IData; override;
776775 function equalTo (ft: TFollowTo): boolean; override;
777776end ;
778777
@@ -817,7 +816,7 @@ TDataProcessing = class
817816 parent: TProcessingContext;
818817 function process (data: IData): TFollowToList; virtual ; abstract ;
819818
820- procedure readOptions (reader: TOptionReaderWrapper); virtual ;
819+ procedure readOptions ({ %H- } reader: TOptionReaderWrapper); virtual ;
821820 procedure initFromCommandLine (cmdLine: TCommandLineReader); virtual ;
822821 procedure mergeWithObject (obj: TXQValueObject); virtual ;
823822
@@ -870,7 +869,7 @@ TExtraction = class(TDataProcessing)
870869private
871870 currentFollowList: TFollowToList;
872871 currentData: IData;
873- procedure pageProcessed (unused: TMultipageTemplateReader; parser: THtmlTemplateParser);
872+ procedure pageProcessed ({ %H- } unused: TMultipageTemplateReader; parser: THtmlTemplateParser);
874873end ;
875874
876875
@@ -952,7 +951,7 @@ TProcessingContext = class(TDataProcessing)
952951 procedure loadDataForQueryPreParse (const data: IData);
953952 procedure loadDataForQuery (const data: IData; const query: IXQuery);
954953 function evaluateQuery (const query: IXQuery; const data: IData; const allowWithoutReturnValue: boolean = false): IXQValue;
955- procedure httpReact (sender: TInternetAccess; var method: string; var url: TDecodedUrl; var data:TInternetAccessDataBlock; var reaction: TInternetAccessReaction);
954+ procedure httpReact (sender: TInternetAccess; var { %H- } method: string; var { %H- } url: TDecodedUrl; var { %H- } data:TInternetAccessDataBlock; var reaction: TInternetAccessReaction);
956955end ;
957956
958957var globalCurrentExtraction: TExtraction;
@@ -976,7 +975,8 @@ function TFollowToXQVObject.retrieve(parent: TProcessingContext; arecursionLevel
976975 temp: TProcessingContext;
977976 fl: TFollowToList;
978977begin
979- if parent = nil then exit(nil );
978+ result := nil ;
979+ if parent = nil then exit();
980980 temp := TProcessingContext.Create();
981981 fl := TFollowToList.Create;
982982 temp.assignOptions(parent); // do not copy actions/data sources. they would apply to basedata, not to dest
@@ -1191,7 +1191,7 @@ function TOptionReaderFromCommandLine.read(const name: string; out value: Extend
11911191
11921192function TDownload.process (data: IData): TFollowToList;
11931193var
1194- temp, realUrl: String;
1194+ realUrl: String;
11951195 j: LongInt;
11961196 realPath: String;
11971197 realFile: String;
@@ -1674,18 +1674,14 @@ procedure TFollowToList.add(ft: TFollowTo);
16741674
16751675procedure TFollowToList.merge (dest: IXQValue; basedata: IData; parent: TProcessingContext);
16761676var x: IXQValue;
1677- temp: TProcessingContext;
16781677 tempv: TXQValue;
1679- n: TTreeNode;
16801678 keys: TStringList;
16811679 isPureDataSource: Boolean;
16821680 i: Integer;
1683- oldCount: Integer;
16841681
16851682begin
16861683 if dest.kind <> pvkSequence then
16871684 dest := xpathparser.evaluateXPath2(' pxp:resolve-html(., $url)' , dest);
1688- oldCount := count;
16891685 case dest.kind of
16901686 pvkUndefined: exit;
16911687 pvkObject: begin
@@ -2136,7 +2132,7 @@ function TProcessingContext.process(data: IData): TFollowToList;
21362132 if follow <> ' ' then begin
21372133 if res = nil then res := TFollowToList.Create;
21382134
2139- htmlparser.OutputEncoding := eUTF8 ; // todo correct encoding?
2135+ htmlparser.OutputEncoding := CP_UTF8 ; // todo correct encoding?
21402136
21412137 followKind := self.followKind;
21422138 globalDefaultInputFormat := followInputFormat;
@@ -2238,7 +2234,6 @@ function TProcessingContext.process(data: IData): TFollowToList;
22382234
22392235function translateDeprecatedStrings (expr: string): string;
22402236var
2241- regex: TWrappedRegExpr;
22422237 a: array [0 ..2 ] of IXQValue;
22432238begin
22442239 if mycmdline.readFlag(' deprecated-string-options' ) then begin
@@ -2461,7 +2456,6 @@ procedure TExtraction.printExtractedValue(value: IXQValue; invariable: boolean);
24612456
24622457var
24632458 i: Integer;
2464- temp: TXQValueObject;
24652459 x: IXQValue;
24662460begin
24672461 case outputFormat of
@@ -2573,7 +2567,6 @@ procedure TExtraction.pageProcessed(unused: TMultipageTemplateReader; parser: TH
25732567function TExtraction.process (data: IData): TFollowToList;
25742568 function termContainsVariableDefinition (term: TXQTerm): boolean;
25752569 var
2576- i: Integer;
25772570 visitor: TXQTerm_VisitorFindWeirdGlobalVariableDeclarations;
25782571 begin
25792572 if term = nil then exit(false);
@@ -2974,7 +2967,7 @@ procedure TTemplateReaderBreaker.selfLog(sender: TMultipageTemplateReader; logge
29742967var modulePaths: TStringArray;
29752968function loadModuleFromAtUrl (const at, base: string): IXQuery; forward ;
29762969
2977- procedure traceCall (pseudoSelf: tobject; sender: TXQueryEngine; value , info: IXQValue);
2970+ procedure traceCall ({ %H- } pseudoSelf: tobject; { %H- } sender: TXQueryEngine; value , info: IXQValue);
29782971begin
29792972 if not info.isUndefined then write(stderr, info.toJoinedString() + ' : ' );
29802973 writeln(stderr, value .toXQuery());
@@ -3286,7 +3279,7 @@ function popCommandLineState: TProcessingContext;
32863279 commandLineLastHeader := TCommandLineReaderBreaker(mycmdline).readString(' header' );
32873280end ;
32883281
3289- procedure variableInterpret (pseudoself, sender: TObject; var name , value : string; const args: TStringArray; var argpos: integer);
3282+ procedure variableInterpret ({ %H- } pseudoself, { %H- } sender: TObject; var name , value : string; const { %H- } args: TStringArray; var { %H- } argpos: integer);
32903283begin
32913284 if strBeginsWith(name , ' xmlns:' ) then begin
32923285 value := strCopyFrom(name , length(' xmlns:' ) + 1 ) + ' =' + value ;
@@ -3312,7 +3305,7 @@ function combineMultiArgs(var oldValue: string; appendValue, separator: string):
33123305 Result := oldValue;
33133306end ;
33143307
3315- procedure variableRead (pseudoself: TObject; sender: TObject; const name , value : string);
3308+ procedure variableRead ({ %H- } pseudoself: TObject; sender: TObject; const name , value : string);
33163309 procedure closeAllMultiArgs ;
33173310 begin
33183311 closeMultiArgs(commandLineStackLastPostData, ' &' );
@@ -3578,7 +3571,7 @@ function loadModuleFromAtUrl(const at, base: string): IXQuery;
35783571 result.getTerm;
35793572end ;
35803573
3581- procedure importModule (pseudoSelf: tobject; sender: TXQueryEngine; context: TXQStaticContext; const namespace: string; const at: array of string);
3574+ procedure importModule ({ %H- } pseudoSelf: tobject; { %H- } sender: TXQueryEngine; context: TXQStaticContext; const namespace: string; const at: array of string);
35823575var
35833576 q: IXQuery;
35843577begin
@@ -3616,10 +3609,10 @@ procedure perform;
36163609 if cgimode or (not allowFileAccess) then blockFileAccessFunctions;
36173610
36183611 // normalized formats (for use in unittests)
3619- DecimalSeparator:=' .' ;
3620- ThousandSeparator:=#0 ;
3621- ShortDateFormat:=' YYYY-MM-DD' ;
3622- LongDateFormat:=' YYYY-MM-DD' ;
3612+ DecimalSeparator{ %H- } :=' .' ;
3613+ ThousandSeparator{ %H- } :=#0 ;
3614+ ShortDateFormat{ %H- } :=' YYYY-MM-DD' ;
3615+ LongDateFormat{ %H- } :=' YYYY-MM-DD' ;
36233616 SetExceptionMask([exInvalidOp, exDenormalized, { exZeroDivide,} exOverflow, exUnderflow, exPrecision]);
36243617 registerModuleMath;
36253618 { $ifdef win32} systemEncodingIsUTF8:=getACP = CP_UTF8;{ $endif}
@@ -4034,19 +4027,19 @@ function xqfSystem(argc: SizeInt; args: PIXQValue): IXQValue;
40344027 end ;
40354028end ;
40364029
4037- function xqfRead (argc: SizeInt; args: PIXQValue): IXQValue;
4030+ function xqfRead ({ %H- } argc: SizeInt; { %H- } args: PIXQValue): IXQValue;
40384031var s: string;
40394032begin
40404033 ReadLn(s);
40414034 result := TXQValueString.create(baseSchema.untypedAtomic, s);
40424035end ;
40434036
4044- function xqfArgc (argc: SizeInt; args: PIXQValue): IXQValue;
4037+ function xqfArgc ({ %H- } argc: SizeInt; { %H- } args: PIXQValue): IXQValue;
40454038begin
40464039 result := xqvalue(paramcount);
40474040end ;
40484041
4049- function xqfArgv (argc: SizeInt; args: PIXQValue): IXQValue;
4042+ function xqfArgv ({ %H- } argc: SizeInt; args: PIXQValue): IXQValue;
40504043begin
40514044 result := xqvalue(ParamStr(args[0 ].toInt64));
40524045end ;
@@ -4106,20 +4099,20 @@ function xqfRequest(const cxt: TXQEvaluationContext; argc: SizeInt; args: PIXQVa
41064099 end ;
41074100end ;
41084101
4109- function xqFunctionJSONSafe (const context: TXQEvaluationContext; argc: SizeInt; args: PIXQValue): IXQValue;
4102+ function xqFunctionJSONSafe (const { %H- } context: TXQEvaluationContext; argc: SizeInt; args: PIXQValue): IXQValue;
41104103var jn: TXQNativeModule;
41114104begin
41124105 jn := TXQueryEngine.findNativeModule(' http://jsoniq.org/functions' );
41134106 result := jn.findBasicFunction(' parse-json' , argc).func(argc,args);
41144107end ;
41154108
4116- function xqFunctionBlocked (const context: TXQEvaluationContext; argc: SizeInt; args: PIXQValue): IXQValue;
4109+ function xqFunctionBlocked (const context: TXQEvaluationContext; { %H- } argc: SizeInt; { %H- } args: PIXQValue): IXQValue;
41174110begin
41184111 ignore(context);
41194112 raise EXQEvaluationException.create(' pxp:cgi' , ' function is not allowed in cgi mode' );
41204113 result := nil ;
41214114end ;
4122- function xqFunctionBlockedSimple (argc: SizeInt; args: PIXQValue): IXQValue;
4115+ function xqFunctionBlockedSimple ({ %H- } argc: SizeInt; { %H- } args: PIXQValue): IXQValue;
41234116begin
41244117 raise EXQEvaluationException.create(' pxp:cgi' , ' function is not allowed in cgi mode' );
41254118 result := nil ;
@@ -4204,7 +4197,7 @@ function BigDecimalToBase(bd: bigdecimal; const bdbase: bigdecimal): string;
42044197 if negative then result := ' -' + result;
42054198end ;
42064199
4207- function xqfIntegerToBase (argc: SizeInt; args: PIXQValue): IXQValue;
4200+ function xqfIntegerToBase ({ %H- } argc: SizeInt; args: PIXQValue): IXQValue;
42084201var
42094202 base: Int64;
42104203 resstr: RawByteString;
0 commit comments