...
 
Commits (2)
#!/bin/sh #!/bin/bash
umask 0022 umask 0022
builddir=/tmp/xideldebbuild builddir=/tmp/xideldebbuild
rm -rf $builddir/ rm -rf $builddir/
......
...@@ -202,7 +202,7 @@ THtmlTemplateParserBreaker = class(THtmlTemplateParser) ...@@ -202,7 +202,7 @@ THtmlTemplateParserBreaker = class(THtmlTemplateParser)
procedure parseHTMLSimple(const data: IData); procedure parseHTMLSimple(const data: IData);
procedure closeVariableLog; procedure closeVariableLog;
procedure parseDoc(sender: TXQueryEngine; html,uri,contenttype: string; var node: TTreeNode); procedure parseDoc({%H-}sender: TXQueryEngine; html,uri,contenttype: string; var node: TTreeNode);
end; end;
{ TTemplateReaderBreaker } { TTemplateReaderBreaker }
...@@ -212,7 +212,7 @@ end; ...@@ -212,7 +212,7 @@ end;
destructor destroy(); override; destructor destroy(); override;
procedure setTemplate(atemplate: TMultiPageTemplate); procedure setTemplate(atemplate: TMultiPageTemplate);
procedure perform(actions: TStringArray); procedure perform(actions: TStringArray);
procedure selfLog(sender: TMultipageTemplateReader; logged: string; debugLevel: integer); procedure selfLog({%H-}sender: TMultipageTemplateReader; logged: string; debugLevel: integer);
end; end;
...@@ -263,7 +263,6 @@ end; ...@@ -263,7 +263,6 @@ end;
function setTextEncoding(var t: TextFile; e: string): integer; function setTextEncoding(var t: TextFile; e: string): integer;
var var
codepage: Integer; codepage: Integer;
str: String;
begin begin
codepage := strEncodingFromName(e); codepage := strEncodingFromName(e);
if codepage = CP_NONE then begin if codepage = CP_NONE then begin
...@@ -753,7 +752,7 @@ TDirectDataRequest = class(TFollowTo) ...@@ -753,7 +752,7 @@ TDirectDataRequest = class(TFollowTo)
data: string; data: string;
constructor create(adata: string); constructor create(adata: string);
function clone: TFollowTo; override; function clone: TFollowTo; override;
function retrieve(parent: TProcessingContext; arecursionLevel: integer): IData; override; function retrieve({%H-}parent: TProcessingContext; arecursionLevel: integer): IData; override;
function equalTo(ft: TFollowTo): boolean; override; function equalTo(ft: TFollowTo): boolean; override;
//procedure replaceVariables; do not replace vars in direct data //procedure replaceVariables; do not replace vars in direct data
end; end;
...@@ -762,7 +761,7 @@ end; ...@@ -762,7 +761,7 @@ end;
TStdinDataRequest = class(TFollowTo) TStdinDataRequest = class(TFollowTo)
function clone: TFollowTo; override; function clone: TFollowTo; override;
function retrieve(parent: TProcessingContext; arecursionLevel: integer): IData; override; function retrieve({%H-}parent: TProcessingContext; arecursionLevel: integer): IData; override;
function equalTo(ft: TFollowTo): boolean; override; function equalTo(ft: TFollowTo): boolean; override;
end; end;
...@@ -772,7 +771,7 @@ TFollowToProcessedData = class(TFollowTo) ...@@ -772,7 +771,7 @@ TFollowToProcessedData = class(TFollowTo)
data: IData; data: IData;
constructor create(d: IData); constructor create(d: IData);
function clone: TFollowTo; override; function clone: TFollowTo; override;
function retrieve(parent: TProcessingContext; arecursionLevel: integer): IData; override; function retrieve({%H-}parent: TProcessingContext; arecursionLevel: integer): IData; override;
function equalTo(ft: TFollowTo): boolean; override; function equalTo(ft: TFollowTo): boolean; override;
end; end;
...@@ -817,7 +816,7 @@ TDataProcessing = class ...@@ -817,7 +816,7 @@ TDataProcessing = class
parent: TProcessingContext; parent: TProcessingContext;
function process(data: IData): TFollowToList; virtual; abstract; function process(data: IData): TFollowToList; virtual; abstract;
procedure readOptions(reader: TOptionReaderWrapper); virtual; procedure readOptions({%H-}reader: TOptionReaderWrapper); virtual;
procedure initFromCommandLine(cmdLine: TCommandLineReader); virtual; procedure initFromCommandLine(cmdLine: TCommandLineReader); virtual;
procedure mergeWithObject(obj: TXQValueObject); virtual; procedure mergeWithObject(obj: TXQValueObject); virtual;
...@@ -870,7 +869,7 @@ TExtraction = class(TDataProcessing) ...@@ -870,7 +869,7 @@ TExtraction = class(TDataProcessing)
private private
currentFollowList: TFollowToList; currentFollowList: TFollowToList;
currentData: IData; currentData: IData;
procedure pageProcessed(unused: TMultipageTemplateReader; parser: THtmlTemplateParser); procedure pageProcessed({%H-}unused: TMultipageTemplateReader; parser: THtmlTemplateParser);
end; end;
...@@ -952,7 +951,7 @@ private ...@@ -952,7 +951,7 @@ private
procedure loadDataForQueryPreParse(const data: IData); procedure loadDataForQueryPreParse(const data: IData);
procedure loadDataForQuery(const data: IData; const query: IXQuery); procedure loadDataForQuery(const data: IData; const query: IXQuery);
function evaluateQuery(const query: IXQuery; const data: IData; const allowWithoutReturnValue: boolean = false): IXQValue; function evaluateQuery(const query: IXQuery; const data: IData; const allowWithoutReturnValue: boolean = false): IXQValue;
procedure httpReact (sender: TInternetAccess; var method: string; var url: TDecodedUrl; var data:TInternetAccessDataBlock; var reaction: TInternetAccessReaction); procedure httpReact (sender: TInternetAccess; var {%H-}method: string; var {%H-}url: TDecodedUrl; var {%H-}data:TInternetAccessDataBlock; var reaction: TInternetAccessReaction);
end; end;
var globalCurrentExtraction: TExtraction; var globalCurrentExtraction: TExtraction;
...@@ -976,7 +975,8 @@ var ...@@ -976,7 +975,8 @@ var
temp: TProcessingContext; temp: TProcessingContext;
fl: TFollowToList; fl: TFollowToList;
begin begin
if parent = nil then exit(nil); result := nil;
if parent = nil then exit();
temp := TProcessingContext.Create(); temp := TProcessingContext.Create();
fl := TFollowToList.Create; fl := TFollowToList.Create;
temp.assignOptions(parent); //do not copy actions/data sources. they would apply to basedata, not to dest temp.assignOptions(parent); //do not copy actions/data sources. they would apply to basedata, not to dest
...@@ -1191,7 +1191,7 @@ end; ...@@ -1191,7 +1191,7 @@ end;
function TDownload.process(data: IData): TFollowToList; function TDownload.process(data: IData): TFollowToList;
var var
temp, realUrl: String; realUrl: String;
j: LongInt; j: LongInt;
realPath: String; realPath: String;
realFile: String; realFile: String;
...@@ -1674,18 +1674,14 @@ end; ...@@ -1674,18 +1674,14 @@ end;
procedure TFollowToList.merge(dest: IXQValue; basedata: IData; parent: TProcessingContext); procedure TFollowToList.merge(dest: IXQValue; basedata: IData; parent: TProcessingContext);
var x: IXQValue; var x: IXQValue;
temp: TProcessingContext;
tempv: TXQValue; tempv: TXQValue;
n: TTreeNode;
keys: TStringList; keys: TStringList;
isPureDataSource: Boolean; isPureDataSource: Boolean;
i: Integer; i: Integer;
oldCount: Integer;
begin begin
if dest.kind <> pvkSequence then if dest.kind <> pvkSequence then
dest := xpathparser.evaluateXPath2('pxp:resolve-html(., $url)', dest); dest := xpathparser.evaluateXPath2('pxp:resolve-html(., $url)', dest);
oldCount := count;
case dest.kind of case dest.kind of
pvkUndefined: exit; pvkUndefined: exit;
pvkObject: begin pvkObject: begin
...@@ -2136,7 +2132,7 @@ var next, res: TFollowToList; ...@@ -2136,7 +2132,7 @@ var next, res: TFollowToList;
if follow <> '' then begin if follow <> '' then begin
if res = nil then res := TFollowToList.Create; if res = nil then res := TFollowToList.Create;
htmlparser.OutputEncoding := eUTF8; //todo correct encoding? htmlparser.OutputEncoding := CP_UTF8; //todo correct encoding?
followKind := self.followKind; followKind := self.followKind;
globalDefaultInputFormat := followInputFormat; globalDefaultInputFormat := followInputFormat;
...@@ -2238,7 +2234,6 @@ end; ...@@ -2238,7 +2234,6 @@ end;
function translateDeprecatedStrings(expr: string): string; function translateDeprecatedStrings(expr: string): string;
var var
regex: TWrappedRegExpr;
a: array[0..2] of IXQValue; a: array[0..2] of IXQValue;
begin begin
if mycmdline.readFlag('deprecated-string-options') then begin if mycmdline.readFlag('deprecated-string-options') then begin
...@@ -2461,7 +2456,6 @@ procedure TExtraction.printExtractedValue(value: IXQValue; invariable: boolean); ...@@ -2461,7 +2456,6 @@ procedure TExtraction.printExtractedValue(value: IXQValue; invariable: boolean);
var var
i: Integer; i: Integer;
temp: TXQValueObject;
x: IXQValue; x: IXQValue;
begin begin
case outputFormat of case outputFormat of
...@@ -2573,7 +2567,6 @@ end; ...@@ -2573,7 +2567,6 @@ end;
function TExtraction.process(data: IData): TFollowToList; function TExtraction.process(data: IData): TFollowToList;
function termContainsVariableDefinition(term: TXQTerm): boolean; function termContainsVariableDefinition(term: TXQTerm): boolean;
var var
i: Integer;
visitor: TXQTerm_VisitorFindWeirdGlobalVariableDeclarations; visitor: TXQTerm_VisitorFindWeirdGlobalVariableDeclarations;
begin begin
if term = nil then exit(false); if term = nil then exit(false);
...@@ -2974,7 +2967,7 @@ end; ...@@ -2974,7 +2967,7 @@ end;
var modulePaths: TStringArray; var modulePaths: TStringArray;
function loadModuleFromAtUrl(const at, base: string): IXQuery; forward; function loadModuleFromAtUrl(const at, base: string): IXQuery; forward;
procedure traceCall(pseudoSelf: tobject; sender: TXQueryEngine; value, info: IXQValue); procedure traceCall({%H-}pseudoSelf: tobject; {%H-}sender: TXQueryEngine; value, info: IXQValue);
begin begin
if not info.isUndefined then write(stderr, info.toJoinedString() + ': '); if not info.isUndefined then write(stderr, info.toJoinedString() + ': ');
writeln(stderr, value.toXQuery()); writeln(stderr, value.toXQuery());
...@@ -3286,7 +3279,7 @@ begin ...@@ -3286,7 +3279,7 @@ begin
commandLineLastHeader := TCommandLineReaderBreaker(mycmdline).readString('header'); commandLineLastHeader := TCommandLineReaderBreaker(mycmdline).readString('header');
end; end;
procedure variableInterpret(pseudoself, sender: TObject; var name, value: string; const args: TStringArray; var argpos: integer); procedure variableInterpret({%H-}pseudoself, {%H-}sender: TObject; var name, value: string; const {%H-}args: TStringArray; var {%H-}argpos: integer);
begin begin
if strBeginsWith(name, 'xmlns:') then begin if strBeginsWith(name, 'xmlns:') then begin
value := strCopyFrom(name, length('xmlns:') + 1) + '=' + value; value := strCopyFrom(name, length('xmlns:') + 1) + '=' + value;
...@@ -3312,7 +3305,7 @@ begin ...@@ -3312,7 +3305,7 @@ begin
Result := oldValue; Result := oldValue;
end; end;
procedure variableRead(pseudoself: TObject; sender: TObject; const name, value: string); procedure variableRead({%H-}pseudoself: TObject; sender: TObject; const name, value: string);
procedure closeAllMultiArgs; procedure closeAllMultiArgs;
begin begin
closeMultiArgs(commandLineStackLastPostData, '&'); closeMultiArgs(commandLineStackLastPostData, '&');
...@@ -3578,7 +3571,7 @@ begin ...@@ -3578,7 +3571,7 @@ begin
result.getTerm; result.getTerm;
end; end;
procedure importModule(pseudoSelf: tobject; sender: TXQueryEngine; context: TXQStaticContext; const namespace: string; const at: array of string); procedure importModule({%H-}pseudoSelf: tobject; {%H-}sender: TXQueryEngine; context: TXQStaticContext; const namespace: string; const at: array of string);
var var
q: IXQuery; q: IXQuery;
begin begin
...@@ -3616,10 +3609,10 @@ begin ...@@ -3616,10 +3609,10 @@ begin
if cgimode or (not allowFileAccess) then blockFileAccessFunctions; if cgimode or (not allowFileAccess) then blockFileAccessFunctions;
//normalized formats (for use in unittests) //normalized formats (for use in unittests)
DecimalSeparator:='.'; DecimalSeparator{%H-}:='.';
ThousandSeparator:=#0; ThousandSeparator{%H-}:=#0;
ShortDateFormat:='YYYY-MM-DD'; ShortDateFormat{%H-}:='YYYY-MM-DD';
LongDateFormat:='YYYY-MM-DD'; LongDateFormat{%H-}:='YYYY-MM-DD';
SetExceptionMask([exInvalidOp, exDenormalized, {exZeroDivide,} exOverflow, exUnderflow, exPrecision]); SetExceptionMask([exInvalidOp, exDenormalized, {exZeroDivide,} exOverflow, exUnderflow, exPrecision]);
registerModuleMath; registerModuleMath;
{$ifdef win32}systemEncodingIsUTF8:=getACP = CP_UTF8;{$endif} {$ifdef win32}systemEncodingIsUTF8:=getACP = CP_UTF8;{$endif}
...@@ -4034,19 +4027,19 @@ begin ...@@ -4034,19 +4027,19 @@ begin
end; end;
end; end;
function xqfRead(argc: SizeInt; args: PIXQValue): IXQValue; function xqfRead({%H-}argc: SizeInt; {%H-}args: PIXQValue): IXQValue;
var s: string; var s: string;
begin begin
ReadLn(s); ReadLn(s);
result := TXQValueString.create(baseSchema.untypedAtomic, s); result := TXQValueString.create(baseSchema.untypedAtomic, s);
end; end;
function xqfArgc(argc: SizeInt; args: PIXQValue): IXQValue; function xqfArgc({%H-}argc: SizeInt; {%H-}args: PIXQValue): IXQValue;
begin begin
result := xqvalue(paramcount); result := xqvalue(paramcount);
end; end;
function xqfArgv(argc: SizeInt; args: PIXQValue): IXQValue; function xqfArgv({%H-}argc: SizeInt; args: PIXQValue): IXQValue;
begin begin
result := xqvalue(ParamStr(args[0].toInt64)); result := xqvalue(ParamStr(args[0].toInt64));
end; end;
...@@ -4106,20 +4099,20 @@ begin ...@@ -4106,20 +4099,20 @@ begin
end; end;
end; end;
function xqFunctionJSONSafe(const context: TXQEvaluationContext; argc: SizeInt; args: PIXQValue): IXQValue; function xqFunctionJSONSafe(const {%H-}context: TXQEvaluationContext; argc: SizeInt; args: PIXQValue): IXQValue;
var jn: TXQNativeModule; var jn: TXQNativeModule;
begin begin
jn := TXQueryEngine.findNativeModule('http://jsoniq.org/functions'); jn := TXQueryEngine.findNativeModule('http://jsoniq.org/functions');
result := jn.findBasicFunction('parse-json', argc).func(argc,args); result := jn.findBasicFunction('parse-json', argc).func(argc,args);
end; end;
function xqFunctionBlocked(const context: TXQEvaluationContext; argc: SizeInt; args: PIXQValue): IXQValue; function xqFunctionBlocked(const context: TXQEvaluationContext; {%H-}argc: SizeInt; {%H-}args: PIXQValue): IXQValue;
begin begin
ignore(context); ignore(context);
raise EXQEvaluationException.create('pxp:cgi', 'function is not allowed in cgi mode'); raise EXQEvaluationException.create('pxp:cgi', 'function is not allowed in cgi mode');
result := nil; result := nil;
end; end;
function xqFunctionBlockedSimple(argc: SizeInt; args: PIXQValue): IXQValue; function xqFunctionBlockedSimple({%H-}argc: SizeInt; {%H-}args: PIXQValue): IXQValue;
begin begin
raise EXQEvaluationException.create('pxp:cgi', 'function is not allowed in cgi mode'); raise EXQEvaluationException.create('pxp:cgi', 'function is not allowed in cgi mode');
result := nil; result := nil;
...@@ -4204,7 +4197,7 @@ begin ...@@ -4204,7 +4197,7 @@ begin
if negative then result := '-' + result; if negative then result := '-' + result;
end; end;
function xqfIntegerToBase(argc: SizeInt; args: PIXQValue): IXQValue; function xqfIntegerToBase({%H-}argc: SizeInt; args: PIXQValue): IXQValue;
var var
base: Int64; base: Int64;
resstr: RawByteString; resstr: RawByteString;
......