You've already forked lazarus-ccr
various flags will now be aliased to integer. This makes using flags much easier
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2009 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -501,51 +501,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPascalUnit.AddGLibSupportCode;
|
procedure TPascalUnit.AddGLibSupportCode;
|
||||||
const
|
|
||||||
BitFRecord =
|
|
||||||
' TBitObject32 = object' +LineEnding+
|
|
||||||
' protected' +LineEnding+
|
|
||||||
' procedure SetBit(AMask: Integer; AValue: DWord);' +LineEnding+
|
|
||||||
' function GetBit(AMask: Integer): DWord;' +LineEnding+
|
|
||||||
' public' +LineEnding+
|
|
||||||
' Flags0: DWord;' +LineEnding+
|
|
||||||
' procedure Init(AFlags: DWord);' +LineEnding+
|
|
||||||
' end;';
|
|
||||||
|
|
||||||
BFRecordImpl :AnsiString =
|
|
||||||
'procedure TBitObject32.Init(AFlags: DWord);' +LineEnding+
|
|
||||||
'begin' +LineEnding+
|
|
||||||
' Flags0 := AFlags;' +LineEnding+
|
|
||||||
'end;' +LineEnding+
|
|
||||||
'' +LineEnding+
|
|
||||||
'procedure TBitObject32.SetBit(AMask: Integer; AValue: DWord);'+LineEnding+
|
|
||||||
'begin' +LineEnding+
|
|
||||||
' if AValue <> 0 then' +LineEnding+
|
|
||||||
' begin' +LineEnding+
|
|
||||||
' if (Flags0 and AMask) = 0 then' +LineEnding+
|
|
||||||
' Flags0 := Flags0 or AMask' +LineEnding+
|
|
||||||
' end' +LineEnding+
|
|
||||||
' else begin' +LineEnding+
|
|
||||||
' if (Flags0 and AMask) <> 0 then' +LineEnding+
|
|
||||||
' Flags0 := Flags0 xor AMask;' +LineEnding+
|
|
||||||
' end;' +LineEnding+
|
|
||||||
'end;' +LineEnding+
|
|
||||||
'' +LineEnding+
|
|
||||||
'function TBitObject32.GetBit(AMask: Integer): DWord;' +LineEnding+
|
|
||||||
'begin' +LineEnding+
|
|
||||||
' Result := Flags0 and AMask;' +LineEnding+
|
|
||||||
' if Result > 1 then' +LineEnding+
|
|
||||||
' Result := 1;' +LineEnding+
|
|
||||||
'end;';
|
|
||||||
var
|
var
|
||||||
CodeText: TPCodeText;
|
|
||||||
TypeSect: TPDeclarationType;
|
TypeSect: TPDeclarationType;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
WantTypeSection.Lines.Add(BitFRecord);
|
|
||||||
CodeText := TPCodeText.Create;
|
|
||||||
CodeText.Content:=BFRecordImpl;
|
|
||||||
ImplementationSection.Declarations.Add(CodeText);
|
|
||||||
|
|
||||||
TypeSect := WantTypeSection;
|
TypeSect := WantTypeSection;
|
||||||
for i := 1 to 31 do
|
for i := 1 to 31 do
|
||||||
@ -762,7 +721,7 @@ end;
|
|||||||
procedure TPascalUnit.HandleAlias(AItem: TgirAlias);
|
procedure TPascalUnit.HandleAlias(AItem: TgirAlias);
|
||||||
var
|
var
|
||||||
ResolvedForName: String;
|
ResolvedForName: String;
|
||||||
CType: TGirBaseType;
|
CType: TGirBaseType = nil;
|
||||||
begin
|
begin
|
||||||
ResolveTypeTranslation(AItem);
|
ResolveTypeTranslation(AItem);
|
||||||
ResolveTypeTranslation(AItem.ForType);
|
ResolveTypeTranslation(AItem.ForType);
|
||||||
@ -773,14 +732,14 @@ begin
|
|||||||
ResolvedForName := aItem.ForType.TranslatedName;
|
ResolvedForName := aItem.ForType.TranslatedName;
|
||||||
if ResolvedForName = '' then
|
if ResolvedForName = '' then
|
||||||
begin
|
begin
|
||||||
|
{
|
||||||
//CType := NameSpace.LookupTypeByName('', AItem.ForType.CType);
|
//CType := NameSpace.LookupTypeByName('', AItem.ForType.CType);
|
||||||
if CType <> nil then
|
if CType <> nil then
|
||||||
ResolvedForName := CType.TranslatedName;
|
ResolvedForName := CType.TranslatedName;
|
||||||
|
|
||||||
if ResolvedForName <> '' then
|
if ResolvedForName <> '' then
|
||||||
aItem.ForType.TranslatedName := ResolvedForName
|
aItem.ForType.TranslatedName := ResolvedForName
|
||||||
else
|
else}
|
||||||
ResolvedForName := AItem.ForType.CType;
|
ResolvedForName := AItem.ForType.CType;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -847,6 +806,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPascalUnit.HandleBitfield(AItem: TgirBitField);
|
procedure TPascalUnit.HandleBitfield(AItem: TgirBitField);
|
||||||
|
{
|
||||||
const
|
const
|
||||||
TemplateLongWord =
|
TemplateLongWord =
|
||||||
'%s = packed object(TBitObject32)'+LineEnding+
|
'%s = packed object(TBitObject32)'+LineEnding+
|
||||||
@ -860,8 +820,10 @@ var
|
|||||||
Entry: String;
|
Entry: String;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
VarType: String;
|
VarType: String;
|
||||||
|
}
|
||||||
begin
|
begin
|
||||||
|
HandleEnum(AItem, True);
|
||||||
|
(*
|
||||||
Intf := WantTypeSection;
|
Intf := WantTypeSection;
|
||||||
CodeText := TPCodeText.Create;
|
CodeText := TPCodeText.Create;
|
||||||
ImplementationSection.Declarations.Add(CodeText);
|
ImplementationSection.Declarations.Add(CodeText);
|
||||||
@ -878,8 +840,8 @@ begin
|
|||||||
else
|
else
|
||||||
WriteLn('Bitfield <> 16bits');
|
WriteLn('Bitfield <> 16bits');
|
||||||
Halt;
|
Halt;
|
||||||
end;}
|
end;
|
||||||
|
}
|
||||||
HandleEnum(AItem, False);
|
HandleEnum(AItem, False);
|
||||||
|
|
||||||
VarType:='DWord';
|
VarType:='DWord';
|
||||||
@ -896,7 +858,7 @@ begin
|
|||||||
|
|
||||||
CodeText.Content:=Code.Text;
|
CodeText.Content:=Code.Text;
|
||||||
Code.Free;
|
Code.Free;
|
||||||
|
*)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPascalUnit.HandleRecord(AItem: TgirRecord);
|
procedure TPascalUnit.HandleRecord(AItem: TgirRecord);
|
||||||
|
Reference in New Issue
Block a user