gir2pascal: Updated to support generating Gtk4 bindings. Patch from theo222, issue #40196.

This commit is contained in:
Maxim Ganetsky 2023-04-06 01:49:50 +03:00
parent b2afc1b1cf
commit debb889759
4 changed files with 12 additions and 5 deletions

View File

@ -451,6 +451,8 @@ begin
gtClass: HandleClass(ANode);
gtInterface: HandleInterface(ANode);
gtMethod: HandleFunction(ANode);
gtFunctionMacro:; // ignore
gtDocSection: ; // ignore
else
girError(geError, 'Unknown NodeType: '+ANode.NodeName);
end;

View File

@ -568,7 +568,8 @@ begin
begin
FIsArray:=True;
FPropType := TgirNamespace(Owner).LookupTypeByName(TDomElement(Node.FindNode('type')).GetAttribute('name'), Node.GetAttribute('c:type'));
end
end;
gtAttribute:; // ignore
else
WriteLn('Unknown Node Type for property : ', Node.NodeName);
halt(1);

View File

@ -2198,11 +2198,11 @@ end;
function TPascalUnit.SanitizeName(AName: String; AExistingUsedNames: TStringList = nil): String;
var
PascalReservedWords : array[0..30] of String =
PascalReservedWords : array[0..32] of String =
('begin', 'end', 'type', 'of', 'in', 'out', 'function', 'string','file', 'default',
'procedure', 'string', 'boolean', 'array', 'set', 'destructor', 'destroy', 'program',
'property', 'object', 'private', 'constructor', 'inline', 'result', 'interface',
'const', 'raise', 'unit', 'label', 'xor', 'implementation');
'const', 'raise', 'unit', 'label', 'xor', 'implementation','var','to');
Name: String;
Sanity: Integer = 0;
Sucess: Boolean;

View File

@ -34,7 +34,7 @@ type
gtGlibSignal, gtImplements, gtPrerequisite,gtVarArgs, gtObject, gtClassStruct, gtGType,
// Direction for parameters. in is default = no pointer. out and inout means one pointer level.
// If subnode is array then increase pointer level.
gtIn, gtOut, gtInOut, gtSourcePosition
gtIn, gtOut, gtInOut, gtSourcePosition, gtFunctionMacro, gtDocSection, gtAttribute
);
TGirVersion = object
@ -89,7 +89,11 @@ var
'in',
'out',
'inout',
'source-position'
'source-position',
'function-macro',
'docsection',
'attribute'
);
function GirTokenNameToToken(AName: String): TGirToken;