Lazarus

Free Pascal => Beginners => Topic started by: joho on September 03, 2017, 08:20:01 am

Title: do_isdevice () and others
Post by: joho on September 03, 2017, 08:20:01 am
Do these actually exist?

http://wiki.freepascal.org/System_unit_structure#General_tasks

(In particular, do_isdevice)

Doing a grep -ir isdevice in the RTL sources would suggest that it does exist, but ...
Title: Re: do_isdevice () and others
Post by: molly on September 03, 2017, 08:39:47 am
Yes, they do exist so also do_isdevice.

As the java version states (jsystem.inc):
Quote
{ for some OSes do_isdevice is defined in sysos.inc, but for others (win32) it isn't, and is used before the actual definition is encountered         }
Doing a grep will show you that the actual implementations are scattered around (depending on platform as stated in wiki). Usually you should be able to find the implementation inside sysfile.inc

Title: Re: do_isdevice () and others
Post by: joho on September 03, 2017, 11:42:11 am
Excellent. So, "USES ..." what unit will give them to me? sysutils?
Title: Re: do_isdevice () and others
Post by: molly on September 03, 2017, 11:59:35 am
Ah sorry, i misunderstood you.

I thought you wanted to have a look at how things are implemented for certain platforms.

They are for internal use, e.g. when you want to extend the RTL. In which case you include the correct includefile (as can be seen in system.inc).
Title: Re: do_isdevice () and others
Post by: joho on September 04, 2017, 08:48:08 am
OK ... but why can't this interface be published?

It's quite a useful function to figure out if a file / handle belongs to an actual file or if it's a device of some sort ... FileIsDevice (const fh: THandle) or FileNameIsDevice (const fn: somecoolansipcharstringtypeprobably)?
TinyPortal © 2005-2018