mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 21:41:01 +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;
|
exit;
|
||||||
end;
|
end;
|
||||||
case Node.Desc of
|
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:='';
|
else Result:='';
|
||||||
end;
|
end;
|
||||||
Result:=Result+'('+CCNodeDescAsString(Node.Desc,Node.SubDesc)
|
Result:=Result+'('+CCNodeDescAsString(Node.Desc,Node.SubDesc)
|
||||||
|
@ -519,6 +519,7 @@ function TH2PasTool.ConvertStruct(CNode: TCodeTreeNode; ParentNode: TH2PNode
|
|||||||
var
|
var
|
||||||
CurName: String;
|
CurName: String;
|
||||||
CurCName: String;
|
CurCName: String;
|
||||||
|
ChildCNode: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
CurName:=CTool.ExtractStructName(CNode);
|
CurName:=CTool.ExtractStructName(CNode);
|
||||||
@ -533,7 +534,12 @@ begin
|
|||||||
nil,ParentNode=nil);
|
nil,ParentNode=nil);
|
||||||
DebugLn(['TH2PasTool.ConvertStruct ADDED ',Result.DescAsString(CTool)]);
|
DebugLn(['TH2PasTool.ConvertStruct ADDED ',Result.DescAsString(CTool)]);
|
||||||
// build recursively
|
// 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;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -240,6 +240,11 @@ begin
|
|||||||
TestIntf('convert struct SwsContext;',
|
TestIntf('convert struct SwsContext;',
|
||||||
'struct SwsContext;',
|
'struct SwsContext;',
|
||||||
'type SwsContext = record end;');
|
'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;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
Loading…
Reference in New Issue
Block a user