mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 03:48:08 +02:00
codetools: h2pas: structs with sub defs
git-svn-id: trunk@31321 -
This commit is contained in:
parent
1346c39a97
commit
7116120872
@ -2599,7 +2599,7 @@ begin
|
||||
exit;
|
||||
end;
|
||||
case Node.Desc of
|
||||
ccnName: Result:=copy(Src,Node.StartPos,Node.EndPos-Node.StartPos);
|
||||
ccnName, ccnTypeName: Result:=copy(Src,Node.StartPos,Node.EndPos-Node.StartPos);
|
||||
else Result:='';
|
||||
end;
|
||||
Result:=Result+'('+CCNodeDescAsString(Node.Desc,Node.SubDesc)
|
||||
|
@ -519,6 +519,7 @@ function TH2PasTool.ConvertStruct(CNode: TCodeTreeNode; ParentNode: TH2PNode
|
||||
var
|
||||
CurName: String;
|
||||
CurCName: String;
|
||||
ChildCNode: TCodeTreeNode;
|
||||
begin
|
||||
Result:=nil;
|
||||
CurName:=CTool.ExtractStructName(CNode);
|
||||
@ -533,7 +534,12 @@ begin
|
||||
nil,ParentNode=nil);
|
||||
DebugLn(['TH2PasTool.ConvertStruct ADDED ',Result.DescAsString(CTool)]);
|
||||
// build recursively
|
||||
BuildH2PTree(Result);
|
||||
ChildCNode:=CNode.FirstChild;
|
||||
while (ChildCNode<>nil) do begin
|
||||
if (ChildCNode.Desc=ccnSubDefs) and (ChildCNode.FirstChild<>nil) then
|
||||
BuildH2PTree(Result,ChildCNode.FirstChild);
|
||||
ChildCNode:=ChildCNode.NextBrother;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -240,6 +240,11 @@ begin
|
||||
TestIntf('convert struct SwsContext;',
|
||||
'struct SwsContext;',
|
||||
'type SwsContext = record end;');
|
||||
TestIntf('convert struct hidp_connlist_req {uint32_t cnum;};',
|
||||
'struct hidp_connlist_req {'+LineEnding
|
||||
+' uint32_t cnum;'+LineEnding
|
||||
+'};',
|
||||
'type hidp_connlist_req = record cnum:cuint32; end;');
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
Loading…
Reference in New Issue
Block a user