Latest fixes. Fixed bug where params that were pointers to types were not recognized

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2086 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
drewski207
2011-10-22 20:09:07 +00:00
parent 04d7c59350
commit dc39460b7e
3 changed files with 21 additions and 5 deletions

View File

@ -30,7 +30,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
<CommandLineParams Value="-i /usr/share/gir-1.0/Gtk-3.0.gir -o /tmp/gir-out -w -D"/>
<CommandLineParams Value="-i /usr/share/gir-1.0/WebKit-3.0.gir -o /home/andrew/programming/lazarus-ccr/bindings/gtk3/ -w"/>
<LaunchingApplication PathPlusParams="/usr/bin/gnome-terminal -t 'Lazarus Run Output' -e '$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)'"/>
</local>
</RunParams>

View File

@ -822,6 +822,7 @@ begin
gtDoc:;
gtType: begin
C_Type := Node.GetAttribute('c:type');
FCType:= C_Type;
VarTypeName:=Node.GetAttribute('name');
if VarTypeName = '' then
VarTypeName:= StringReplace(C_Type, '*', '', [rfReplaceAll]);

View File

@ -993,7 +993,7 @@ var
begin
Result := '';
// we skip deprecated functions
if AFunction.Deprecated and (CompareStr(AFunction.DeprecatedVersion, NameSpace.Version) >= 0) then
if AFunction.Deprecated then //and (CompareStr(AFunction.DeprecatedVersion, NameSpace.Version) >= 0) then
Exit;
// some abstract functions that are to be implemented by a module and shouldn't be declared. There is no indicator in the gir file that this is so :(
@ -1454,7 +1454,7 @@ begin
else
begin
AFunctionType:='function';
AFunctionReturnType:= ': '+TypeAsString(AItem.Returns.VarType, AItem.Returns.PointerLevel)+'; cdecl;' ;
AFunctionReturnType:= ': '+TypeAsString(AItem.Returns.VarType, AItem.Returns.PointerLevel, AItem.Returns.CType)+'; cdecl;' ;
// will skip if written
ProcessType(AItem.Returns.VarType);
@ -1488,11 +1488,19 @@ end;
function TPascalUnit.TypeAsString(AType: TGirBaseType; APointerLevel: Integer; ACTypeAsBackup: String = ''): String;
var
BackupNoPointers: String;
TranslatedName: String;
begin
ResolveTypeTranslation(AType);
TranslatedName := AType.TranslatedName;
BackupNoPointers := StringReplace(ACTypeAsBackup, '*', '', [rfReplaceAll]);
// some types are pointers but contain no "*" so it thinks it has a pointer level 0 when really it's 1
if (APointerLevel = 0) and (ACTypeAsBackup = 'gpointer') and (TranslatedName <> '') and (TranslatedName <> 'gpointer') then
begin
APointerLevel := 1;
end;
if APointerLevel = 0 then
begin
Result := AType.TranslatedName;
@ -1868,9 +1876,16 @@ begin
end;
procedure TPascalUnit.ResolveTypeTranslation(ABaseType: TGirBaseType);
var
RawName: String;
begin
if ABaseType.TranslatedName = '' then
ABaseType.TranslatedName:=MakePascalTypeFromCType(ABaseType.CType, 0);
begin
RawName := ABaseType.CType;
if RawName = '' then
RawName:= ABaseType.Name;
ABaseType.TranslatedName:=MakePascalTypeFromCType(RawName, 0);
end;
end;
constructor TPascalUnit.Create(ANameSpace: TgirNamespace; ALinkDynamic: Boolean; AWantTest: Boolean);