From 0187d5938ad1291bdb8348a527d94113c557c58e Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 22 Mar 2008 22:33:33 +0000 Subject: [PATCH] codetools: h2p: implemented writing simple procedure param lists as pascal git-svn-id: trunk@14619 - --- components/codetools/h2pastool.pas | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/components/codetools/h2pastool.pas b/components/codetools/h2pastool.pas index 50583c5e77..884088c5cd 100644 --- a/components/codetools/h2pastool.pas +++ b/components/codetools/h2pastool.pas @@ -953,6 +953,9 @@ var H2PNode: TH2PNode; UsesClause: String; PascalCode: String; + ChildNode: TH2PNode; + CurName: String; + NoNameCount: Integer; begin IndentStr:=''; @@ -1010,8 +1013,23 @@ begin // global procedure SetSection(ctnNone); PascalCode:=''; - if H2PNode.FirstChild<>nil then begin - + ChildNode:=H2PNode.FirstChild; + NoNameCount:=0; + while ChildNode<>nil do begin + if ChildNode.PascalDesc=ctnVarDefinition then begin + if PascalCode<>'' then + PascalCode:=PascalCode+'; '; + CurName:=ChildNode.PascalName; + if CurName='' then begin + inc(NoNameCount); + CurName:='param'+IntToStr(NoNameCount) + +CreatePascalNameFromCCode(ChildNode.PascalCode); + end; + PascalCode:=PascalCode+CurName+': '+ChildNode.PascalCode; + end else begin + DebugLn(['TH2PasTool.WritePascalToStream SKIPPING ',ChildNode.DescAsString]); + end; + ChildNode:=ChildNode.NextBrother; end; if PascalCode<>'' then PascalCode:='('+PascalCode+')';