Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-14 Thread Anton Shepelev
I wrote: > system.inc defines FileFunc as a procedure without a > return value: > >FileFunc = Procedure(var t : TextRec); > > whereas streamio.pp defines the same operations as > functions returning longint, e.g.: > >Function StreamRead(var F: TTextRec) : longint; Here are the relevant

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-12 Thread Anton Shepelev
I wrote: >> > Notice also that FreePascal's TextRec handling is >> > incompatible with that of Delphi. The TextRec >> > operations OpenFunc, InOutFunc, FlushFunc, and CloseFunc >> > return a longint, which Delphi interprets as the result >> > code but FreePascal ignores. Therefore, I must set

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-11 Thread Anton Shepelev
Sven Barth to Anton Shepelev: > > Writers of drivers for this Pascal-style I/O interface > > should have the ability to convert OS-specific error > > codes into InOurRes values, which are not even > > documented at: > > > >https://www.freepascal.org/docs-html/rtl/system/inoutres.html > >

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-11 Thread Sven Barth via fpc-devel
Anton Shepelev schrieb am Mo., 11. März 2019, 15:12: > Sven Barth to Anton Shepelev: > > >>Since we already have cross-platform functions FileRead > >>and FileWrite, would not it be useful to have them set the > >>InOutRes variable, or to publish a facility for converting > >>the value of

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-11 Thread Anton Shepelev
Sven Barth to Anton Shepelev: >>Since we already have cross-platform functions FileRead >>and FileWrite, would not it be useful to have them set the >>InOutRes variable, or to publish a facility for converting >>the value of GetLastOSError into an InOutRes value? > >The usage of InOutRes is only

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-10 Thread Sven Barth via fpc-devel
Am 10.03.2019 um 11:43 schrieb Anton Shepelev: Michael Van Canneyt to Anton Shepelev: Thank you, but how do I translate the return value of GetLastOSError into a value of InOutRes? The translation functions are privately implemented in sysos.inc . You can copy them. It is open source, after

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-10 Thread Anton Shepelev
Michael Van Canneyt to Anton Shepelev: > > Thank you, but how do I translate the return value of > > GetLastOSError into a value of InOutRes? The > > translation functions are privately implemented in > > sysos.inc . > > You can copy them. It is open source, after all. Which brings us back to

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Michael Van Canneyt
On Sat, 9 Mar 2019, Anton Shepelev wrote: Michael Van Canneyt about FileWrite and FileRead: For these functions, you can get more info with GetLastOSError, and use that to set InOutRes. Thank you, but how do I translate the return value of GetLastOSError into a value of InOutRes? The

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Marco van de Voort
Op 2019-03-09 om 21:45 schreef Anton Shepelev: Marco van de Voort: Really? So why can't you simply use untyped "file"? I am writing a TextRec driver that shall work with a bare THandle, e.g.: Use (objpas.) fileread and filewrite

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Anton Shepelev
Michael Van Canneyt about FileWrite and FileRead: > For these functions, you can get more info with > GetLastOSError, and use that to set InOutRes. Thank you, but how do I translate the return value of GetLastOSError into a value of InOutRes? The translation functions are privately implemented

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Anton Shepelev
Marco van de Voort: > Really? So why can't you simply use untyped "file"? I am writing a TextRec driver that shall work with a bare THandle, e.g.: Program Test; uses TextDrv, SysUtils; var t: Text; s: AnsiString; h: THandle; begin h := FileOpen( 'C:\test.txt', fmOpenRead );

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Marco van de Voort
Op 2019-03-09 om 18:09 schreef Anton Shepelev: FreePascal has many low-level cross-platform functions scattered over multiple .inc files but not consolilated into reusable cross-platform units. Consider, for example, the functions Really? So why can't you simply use untyped "file" ?

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Michael Van Canneyt
On Sat, 9 Mar 2019, Anton Shepelev wrote: Michael Van Canneyt to Anton Shepelev: > function do_read (h: longint; addr: pointer; len: > longint) : longint; function do_write(h: longint; addr: > pointer; len: longint) : longint; I also don't see why you need this. You have this

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Anton Shepelev
Michael Van Canneyt to Anton Shepelev: > > function do_read (h: longint; addr: pointer; len: > > longint) : longint; function do_write(h: longint; addr: > > pointer; len: longint) : longint; > > I also don't see why you need this. You have this > functionality available in a cross-platform

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Sven Barth via fpc-devel
Anton Shepelev schrieb am Sa., 9. März 2019, 18:09: > It would relieve the programmer of writing conditionally > compiled OS-specific code sections for such basic operations > as are already implemented in FreePascal's internals. I, > for example, have to do it whenever my Windws/Unix program >

Re: [fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Michael Van Canneyt
On Sat, 9 Mar 2019, Anton Shepelev wrote: Hello, all FreePascal has many low-level cross-platform functions scattered over multiple .inc files but not consolilated into reusable cross-platform units. Consider, for example, the functions function do_read (h: longint; addr: pointer; len:

[fpc-devel] Publish some of FPC's internal cross-platform functionality

2019-03-09 Thread Anton Shepelev
Hello, all FreePascal has many low-level cross-platform functions scattered over multiple .inc files but not consolilated into reusable cross-platform units. Consider, for example, the functions function do_read (h: longint; addr: pointer; len: longint) : longint; function do_write(h: