Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2001-03

To make more Delphi compatibility!

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pavel V. Ozerski

Hello,
I reported yesterday to developers mailing list my problems which I got while my attempt to port KOL (Key Objects Library, http://kol.nm.ru) to FPC. Some of these problems I tried to solve using compiler patching. This patch I would to send to you; maybe, they are not useless.

I could fix only two Delphi incompatibilities now.
1) Delphi supports properties in BP-style objects. May be, this feature is not well-known but it is used in KOL.
2) If property index value is outside integer range but formal index type in procedure is integer, Delphi compiles source successfully but FPC fails.

All my fixes are two lines in pdecobj.pas.

      procedure property_dec;
        var
           sym : psym;
           propertyparas : tlinkedlist;
        { returns the matching procedure to access a property }
        function get_procdef : pprocdef;
          var
             p : pprocdef;
          begin
             p:=pprocsym(sym)^.definition;
             get_procdef:=nil;
             while assigned(p) do
               begin
                  if convertable_paras(p^.para,propertyparas,cp_value_equal_const) then{**Ozerski 14.03.01, instead equal_paras}
                    break;
                  p:=p^.nextoverloaded;
               end;
             get_procdef:=p;
          end;
        var
           hp2,datacoll : tparaitem;
           p : ppropertysym;
           overriden : psym;
           hs : string;
           varspez : tvarspez;
           sc : tidstringlist;
           s : string;
           tt : ttype;
           declarepos : tfileposinfo;
           pp : pprocdef;
           pt : tnode;
           propname : stringid;
        begin
           { check for a class }
           if not((is_class_or_interface(aktclass))or((m_delphi in aktmodeswitches)and(is_object(aktclass))))then{**Ozerski 14.03.01, new condition added}
            Message(parser_e_syntax_error);

...........................

Sincerely, Pavel

Reply by email

Peter Vreman
Hello, I reported yesterday to developers mailing list my problems which I got while my attempt

to

port KOL (Key Objects Library, http://kol.nm.ru) to FPC. Some of these problems I tried to solve using compiler patching. This patch I would to
send to you;
maybe, they are not useless. I could fix only two Delphi incompatibilities now. 1) Delphi supports properties in BP-style objects. May be, this feature is not

well-known
but it is used in KOL.

2) If property index value is outside integer range but formal index type in procedure

is
integer, Delphi compiles

source successfully but FPC fails.

Thanks for the patches, it's saves us some time to look into the right place to add the fixes.

Reply by email

Pavel V. Ozerski
to Peter Vreman

Sorry, but my last today's patch needs to be patched again because replacing equal_paras to convertable_paras solved some problems but created new problems. Therefore both functions must be called.

Pavel

Patch to patch:

      procedure property_dec;
        var
           sym : psym;
           propertyparas : tlinkedlist;
        { returns the matching procedure to access a property }
        function get_procdef : pprocdef;
          var
             p : pprocdef;
          begin
             p:=pprocsym(sym)^.definition;
             get_procdef:=nil;
             while assigned(p) do
               begin
                  if equal_paras(p^.para,propertyparas,cp_value_equal_const)or convertable_paras(p^.para,propertyparas,cp_value_equal_const)then{**Ozerski 14.03.01}
                    break;
                  p:=p^.nextoverloaded;
               end;
             get_procdef:=p;
          end;
        var
           hp2,datacoll : tparaitem;
           p : ppropertysym;
           overriden : psym;
           hs : string;
           varspez : tvarspez;
           sc : tidstringlist;
           s : string;
           tt : ttype;
           declarepos : tfileposinfo;
           pp : pprocdef;
           pt : tnode;
           propname : stringid;
        begin
           { check for a class }
           if not((is_class_or_interface(aktclass))or((m_delphi in aktmodeswitches)and(is_object(aktclass))))then{**Ozerski 14.03.01}
            Message(parser_e_syntax_error);
           consume(_PROPERTY);

Reply by email

Marco van de Voort
to Pavel V. Ozerski
Sorry, but my last today's patch needs to be patched again because replacing equal_paras to convertable_paras solved some problems but created new problems. Therefore both functions must be called.

Commited to the main branch (1.1).

Marco van de Voort ( or )

Reply by email