*getClass method should become class method for proper class method calling
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@439 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
85ef68394d
commit
252d362cfa
@ -376,7 +376,6 @@ begin
|
|||||||
if (vs[i] = '>') or (vs[i] = '"') then vs := Copy(vs, 1, length(vs) - 1);
|
if (vs[i] = '>') or (vs[i] = '"') then vs := Copy(vs, 1, length(vs) - 1);
|
||||||
if vs = '' then Exit;
|
if vs = '' then Exit;
|
||||||
|
|
||||||
|
|
||||||
pth := vs;
|
pth := vs;
|
||||||
|
|
||||||
while (pth <> '') and (length(pth)>1) do begin
|
while (pth <> '') and (length(pth)>1) do begin
|
||||||
@ -385,11 +384,8 @@ begin
|
|||||||
pth := ExtractFilePath(ExcludeTrailingPathDelimiter(pth));
|
pth := ExtractFilePath(ExcludeTrailingPathDelimiter(pth));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Result := ExtractFileName(vs);
|
Result := ExtractFileName(vs);
|
||||||
Result := Copy(Result, 1, length(Result) - length(ExtractFileExt(vs))) + '.inc';
|
Result := Copy(Result, 1, length(Result) - length(ExtractFileExt(vs))) + '.inc';
|
||||||
|
|
||||||
(*
|
(*
|
||||||
Result := '';
|
Result := '';
|
||||||
if s = '' then Exit;
|
if s = '' then Exit;
|
||||||
@ -626,8 +622,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
mtd._Name := nm;
|
mtd._Name := nm;
|
||||||
|
|
||||||
end else if obj is TPrecompiler then begin
|
|
||||||
WriteOutIfDefPrecompiler(TPrecompiler(obj), ' ', subs);
|
|
||||||
end;
|
end;
|
||||||
end; {of for}
|
end; {of for}
|
||||||
subs.Add('');
|
subs.Add('');
|
||||||
@ -696,12 +690,12 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := Vl;
|
Result := Vl;
|
||||||
//todo: improve! check at h2pas
|
//todo: improve! check at h2pas
|
||||||
repeat ws := Result; Result := ReplaceStr('<<', 'shl', ws); until Result = ws;
|
repeat ws := Result; Result := ReplaceStr('<<', 'shl', ws); until Result = ws;
|
||||||
repeat ws := Result; Result := ReplaceStr('>>', 'shr', ws); until Result = ws;
|
repeat ws := Result; Result := ReplaceStr('>>', 'shr', ws); until Result = ws;
|
||||||
repeat ws := Result; Result := ReplaceStr('||', 'or', ws); until Result = ws;
|
repeat ws := Result; Result := ReplaceStr('||', 'or', ws); until Result = ws;
|
||||||
repeat ws := Result; Result := ReplaceStr('|', 'or', ws); until Result = ws;
|
repeat ws := Result; Result := ReplaceStr('|', 'or', ws); until Result = ws;
|
||||||
repeat ws := Result; Result := ReplaceStr('&&', 'and', ws); until Result = ws;
|
repeat ws := Result; Result := ReplaceStr('&&', 'and', ws); until Result = ws;
|
||||||
repeat ws := Result; Result := ReplaceStr('&', 'and', ws); until Result = ws;
|
repeat ws := Result; Result := ReplaceStr('&', 'and', ws); until Result = ws;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure WriteOutEnumValues(enm: TEnumTypeDef; const Prefix: AnsiString; st: TStrings);
|
procedure WriteOutEnumValues(enm: TEnumTypeDef; const Prefix: AnsiString; st: TStrings);
|
||||||
@ -1012,20 +1006,19 @@ begin
|
|||||||
consts := TStringList.Create;
|
consts := TStringList.Create;
|
||||||
|
|
||||||
try
|
try
|
||||||
(*for i := 0 to hdr.Items.Count - 1 do
|
for i := 0 to hdr.Items.Count - 1 do
|
||||||
if Assigned(hdr.Items[i]) then begin
|
if Assigned(hdr.Items[i]) then
|
||||||
if (TObject(hdr.Items[i]) is TPrecompiler) then begin
|
if (TObject(hdr.Items[i]) is TPrecompiler) then begin
|
||||||
WriteOutIfDefPrecompiler(TPrecompiler(hdr.Items[i]), SpacePrefix, st);
|
WriteOutIfDefPrecompiler(TPrecompiler(hdr.Items[i]), SpacePrefix, st);
|
||||||
WriteOutPrecompInclude(TPrecompiler(hdr.Items[i]), st);
|
WriteOutPrecompInclude(TPrecompiler(hdr.Items[i]), st);
|
||||||
WriteOutPrecompDefine(TPrecompiler(hdr.Items[i]), ' ', subs);
|
WriteOutPrecompDefine(TPrecompiler(hdr.Items[i]), ' ', subs);
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
if subs.Count > 0 then begin
|
if subs.Count > 0 then begin
|
||||||
st.Add('const');
|
st.Add('const');
|
||||||
st.AddStrings(subs);
|
st.AddStrings(subs);
|
||||||
subs.Clear;
|
subs.Clear;
|
||||||
end;*)
|
end;
|
||||||
|
|
||||||
for i := 0 to hdr.Items.Count - 1 do
|
for i := 0 to hdr.Items.Count - 1 do
|
||||||
if Assigned(hdr.Items[i]) then begin
|
if Assigned(hdr.Items[i]) then begin
|
||||||
@ -1261,6 +1254,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
ClassMethodCaller : array [ Boolean] of AnsiString = (
|
||||||
|
'Handler', 'getClass'
|
||||||
|
);
|
||||||
|
|
||||||
// writes out a method to implementation section
|
// writes out a method to implementation section
|
||||||
procedure WriteOutMethod(mtd: TClassMethodDef; subs: TStrings);
|
procedure WriteOutMethod(mtd: TClassMethodDef; subs: TStrings);
|
||||||
var
|
var
|
||||||
@ -1271,8 +1269,7 @@ var
|
|||||||
callobj : AnsiString;
|
callobj : AnsiString;
|
||||||
begin
|
begin
|
||||||
cl := TClassDef(mtd.Owner);
|
cl := TClassDef(mtd.Owner);
|
||||||
if mtd._IsClassMethod then callobj := 'getClass'
|
callobj := ClassMethodCaller[mtd._IsClassMethod];
|
||||||
else callobj := 'Handle';
|
|
||||||
s := Format('vmethod(%s, sel_registerName(PChar(Str%s_%s)), %s)', [callobj, cl._ClassName, RefixName(mtd._Name), GetParamsNames(mtd)]);
|
s := Format('vmethod(%s, sel_registerName(PChar(Str%s_%s)), %s)', [callobj, cl._ClassName, RefixName(mtd._Name), GetParamsNames(mtd)]);
|
||||||
|
|
||||||
if ObjCToDelphiType(mtd.GetResultType._Name, mtd.GetResultType._IsPointer) <> '' then
|
if ObjCToDelphiType(mtd.GetResultType._Name, mtd.GetResultType._IsPointer) <> '' then
|
||||||
@ -1300,11 +1297,8 @@ var
|
|||||||
mnm : AnsiString;
|
mnm : AnsiString;
|
||||||
begin
|
begin
|
||||||
cl := TClassDef(mtd.owner);
|
cl := TClassDef(mtd.owner);
|
||||||
if mtd._IsClassMethod then callobj := 'ClassID'
|
callobj := ClassMethodCaller[mtd._IsClassMethod];
|
||||||
else callobj := 'Handle';
|
|
||||||
|
|
||||||
res := GetMethodResultType(mtd);
|
res := GetMethodResultType(mtd);
|
||||||
|
|
||||||
tp := GetObjCVarType(res);
|
tp := GetObjCVarType(res);
|
||||||
|
|
||||||
if tp = vt_Object then begin
|
if tp = vt_Object then begin
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="ObjCParserUtils.pas"/>
|
<Filename Value="ObjCParserUtils.pas"/>
|
||||||
<UnitName Value="ObjCParserUtils"/>
|
<UnitName Value="ObjCParserUtils"/>
|
||||||
<CursorPos X="1" Y="10"/>
|
<CursorPos X="1" Y="63"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="57"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<UsageCount Value="37"/>
|
<UsageCount Value="37"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
@ -53,7 +53,7 @@
|
|||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="ObjCParserTypes.pas"/>
|
<Filename Value="ObjCParserTypes.pas"/>
|
||||||
<UnitName Value="ObjCParserTypes"/>
|
<UnitName Value="ObjCParserTypes"/>
|
||||||
<CursorPos X="1" Y="10"/>
|
<CursorPos X="1" Y="8"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="2"/>
|
||||||
<UsageCount Value="37"/>
|
<UsageCount Value="37"/>
|
||||||
@ -277,7 +277,20 @@
|
|||||||
<UsageCount Value="9"/>
|
<UsageCount Value="9"/>
|
||||||
</Unit35>
|
</Unit35>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="0" HistoryIndex="-1"/>
|
<JumpHistory Count="3" HistoryIndex="2">
|
||||||
|
<Position1>
|
||||||
|
<Filename Value="ObjCParserUtils.pas"/>
|
||||||
|
<Caret Line="7" Column="49" TopLine="1"/>
|
||||||
|
</Position1>
|
||||||
|
<Position2>
|
||||||
|
<Filename Value="ObjCParserUtils.pas"/>
|
||||||
|
<Caret Line="1529" Column="30" TopLine="1518"/>
|
||||||
|
</Position2>
|
||||||
|
<Position3>
|
||||||
|
<Filename Value="ObjCParserUtils.pas"/>
|
||||||
|
<Caret Line="68" Column="33" TopLine="57"/>
|
||||||
|
</Position3>
|
||||||
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="5"/>
|
<Version Value="5"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user