Recent

Author Topic: [Solved] Where is procedure Delete(), often used in old DELPHI code ?  (Read 2789 times)

PeterX

  • Sr. Member
  • ****
  • Posts: 398
Hi,

I searched the WWW but ..
I searched the Forum but ..

I have a old Delphi file where there was
Code: Pascal  [Select][+][-]
  1.       begin
  2.         delete( s, length(s), 1);
  3.         ...
  4.       end;
  5.  

Originally in uses there was
Code: Pascal  [Select][+][-]
  1. uses
  2.   Windows,
  3. ...
  4.  

But with Interfaces  and JwaWindows  the  delete()  procedure cannot be found
says the compiler ..


I searched the LAZARUS installation folder and ..
I found out, in Freepascal the delete function is in:  system.fpd
Also in  systemh.inc line 1082
But it didn't help me jet ..

Which Unit in USES
do I need to be able to call   delete()  ?

 %)
« Last Edit: July 11, 2021, 02:21:25 pm by PeterX »
usually using latest Lazarus release version with Windows 10

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9697
  • FPC developer.
Re: Where is procedure Delete(), often used in old DELPHI code ?
« Reply #1 on: July 11, 2021, 02:04:59 pm »
Delete, as all functions in system.fpd are built-ins. They are core language parts and built in to the compiler.

The system.fpd is a mock declaration of them for the documentation system, as these functions are documented. Built-ins are always there (only depending on compiler mode), but they are documented as part of system.


PeterX

  • Sr. Member
  • ****
  • Posts: 398
Re: Where is procedure Delete(), often used in old DELPHI code ?
« Reply #2 on: July 11, 2021, 02:07:27 pm »
Delete, as all functions in system.fpd are built-ins. They are core language parts and built in to the compiler.

The system.fpd is a mock declaration of them for the documentation system, as these functions are documented. Built-ins are always there (only depending on compiler mode), but they are documented as part of system.
Okay,

but when commenting out Windows in USES, and using JwaWindows instead,
I get xxx.pas(377,15) Error: Illegal expression

I use {$mode objfpc}{$H+}


Probably some other of my Units has also declared a delete() procedure or function.
This is the only reason I could imagine, why delete() is hidden ..
« Last Edit: July 11, 2021, 02:12:00 pm by PeterX »
usually using latest Lazarus release version with Windows 10

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9697
  • FPC developer.
Re: Where is procedure Delete(), often used in old DELPHI code ?
« Reply #3 on: July 11, 2021, 02:13:52 pm »
Probably some other of my Units has also declared a delete() procedure or function.
This is the only reason I could imagine, why delete() is hidden ..

Just call system.delete() in such cases.

And in general, just use Windows as much as possible, and if it has deficiencies, file bugs.

Moreover, if you need jwa* stuff, use specific units rather than the jwawindows one.

PeterX

  • Sr. Member
  • ****
  • Posts: 398
Re: Where is procedure Delete(), often used in old DELPHI code ?
« Reply #4 on: July 11, 2021, 02:20:56 pm »
[You where faster ..]
« Last Edit: July 11, 2021, 02:22:37 pm by PeterX »
usually using latest Lazarus release version with Windows 10

PeterX

  • Sr. Member
  • ****
  • Posts: 398
Re: Where is procedure Delete(), often used in old DELPHI code ?
« Reply #5 on: July 11, 2021, 02:24:13 pm »
Just call system.delete() in such cases.

And in general, just use Windows as much as possible, and if it has deficiencies, file bugs.

Moreover, if you need jwa* stuff, use specific units rather than the jwawindows one.

Hm, so I was wrong so many years ?
Why should I still use Windows ?

I thought I should avoid it .. ?
usually using latest Lazarus release version with Windows 10

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9697
  • FPC developer.
Re: Where is procedure Delete(), often used in old DELPHI code ?
« Reply #6 on: July 11, 2021, 02:27:09 pm »
Hm, so I was wrong so many years ?
Why should I still use Windows ?

Windows and the other non jwa windows unit are the core Windows units of FPC. Jwa was included because it was somewhat more expansive.

But jwawindows was a bit less delphi compatible and its maintenance stopped before it went to 64-bit. For 64-bit in particular, use windows as much as possible.

Quote
I thought I should avoid it .. ?

How did you think that?  Maybe for portability concerns, but jwawindows won't help you there.

PeterX

  • Sr. Member
  • ****
  • Posts: 398
Re: Where is procedure Delete(), often used in old DELPHI code ?
« Reply #7 on: July 11, 2021, 02:30:39 pm »
Quote
I thought I should avoid it .. ?

How did you think that?  Maybe for portability concerns, but jwawindows won't help you there.

Somehow I thought I would get closer to portability.
But I must realize now, I must have misunderstood something ..  :-\
usually using latest Lazarus release version with Windows 10

PeterX

  • Sr. Member
  • ****
  • Posts: 398
Code: Pascal  [Select][+][-]
  1. uses
  2.   Interfaces,
  3.   Windows,
  4.   //JwaWindows,
  5.   LMessages,
  6.   //messages,
  7.  

Okay, back to Windows.
But keep on using LMessages ?
usually using latest Lazarus release version with Windows 10

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9697
  • FPC developer.
Code: Pascal  [Select][+][-]
  1. uses
  2.   Interfaces,
  3.   Windows,
  4.   //JwaWindows,
  5.   LMessages,
  6.   //messages,
  7.  

Okay, back to Windows.
But keep on using LMessages ?

Yes, lmessages is a LCL internal version of messages. IOW it emulates them on non Windows.

But if you use Windows functionality it is not portable. Some functionality will only be available in a platform specific matter though, so it depends on how hard you need it to be portable.

PeterX

  • Sr. Member
  • ****
  • Posts: 398
Re: [Solved] Where is procedure Delete(), often used in old DELPHI code ?
« Reply #10 on: July 11, 2021, 02:44:19 pm »
Yes, lmessages is a LCL internal version of messages. IOW it emulates them on non Windows.

But if you use Windows functionality it is not portable. Some functionality will only be available in a platform specific matter though, so it depends on how hard you need it to be portable.

Currently I have no need to write portable code, especially in this
windows focused application I am working on atm.

But maybe, probably, some day .. who knows ..
If it's better to use the LCL lmessages, I'd use it instead of ol' messages.
usually using latest Lazarus release version with Windows 10

 

TinyPortal © 2005-2018