human68k: minimal DOS calls error handling/inoutres mapping

This commit is contained in:
Karoly Balogh 2023-12-02 19:30:16 +01:00
parent e1e9a6728f
commit fef24dabd6
3 changed files with 67 additions and 1 deletions

View File

@ -13,6 +13,43 @@
**********************************************************************}
const
DOSE_ILGFNC = -1; { Invalid function code executed }
DOSE_NOENT = -2; { File not found }
DOSE_NODIR = -3; { Directory not found }
DOSE_MFILE = -4; { Too many open files }
DOSE_ISDIR = -5; { Directory and volume label inaccessible }
DOSE_BADF = -6; { The specified handle is not open }
DOSE_BROKNMEM = -7; { The memory management area was destroyed }
DOSE_NOMEM = -8; { Not enough memory for execution }
DOSE_ILGMPTR = -9; { Invalid memory management pointer specified }
DOSE_ILGENV = -10; { Illegal environment specified }
DOSE_ILGFMT = -11; { Abnormal executable file format }
DOSE_ILGARG = -12; { Abnormal open access mode }
DOSE_ILGFNAME = -13; { Invalid file name }
DOSE_ILGPARM = -14; { Called with invalid parameter }
DOSE_ILGDRV = -15; { Invalid drive specified }
DOSE_ISCURDIR = -16; { Current directory can't be deleted }
DOSE_CANTIOC = -17; { ioctrl can not be used }
DOSE_NOMORE = -18; { No more files found }
DOSE_RDONLY = -19; { The file can't be written }
DOSE_EXISTDIR = -20; { The directory already exists }
DOSE_NOTEMPTY = -21; { File can't be deleted }
DOSE_CANTREN = -22; { File can't be renamed }
DOSE_DISKFULL = -23; { File can't be created because disk is full }
DOSE_DIRFULL = -24; { File can't be created because folder is full }
DOSE_CANTSEEK = -25; { Can't seek to the specified position }
DOSE_SUPER = -26; { Supervisor mode require while in supervisor mode }
DOSE_DUPTHNAM = -27; { Thread name exists }
DOSE_CANTSEND = -28; { IPC buffer is write protected }
DOSE_THFULL = -29; { Can't start any more background processes }
DOSE_LCKFULL = -32; { Insufficient lock space }
DOSE_LCKERR = -33; { File is locked and can't be accessed }
DOSE_BUSYDRV = -34; { The drive has a handler open }
DOSE_SYMLOOP = -35; { Symbolic link nest exceeded 16 links(lndrv) }
DOSE_EXISTFILE = -80; { File exists }
type
h68kdos_comline = record
case boolean of

View File

@ -160,5 +160,15 @@ end;
function do_isdevice(handle: thandle): boolean;
begin
do_isdevice:=false;
{ FIX ME! }
{ Prefer to return true here as a default answer, as it is less harmful
than false. This basically determines if the file handle is a "device",
for example the console. Returning true here causes a flush before a
read on the file handle which is preferred for consoleio, and a few
other minor behavioral changes, for example shorter stacktraces.
Returning false will cause weird behavior and unprinted lines when
read() and write() is mixed during consoleio. }
do_isdevice:=true;
end;

View File

@ -19,4 +19,23 @@
procedure Error2InOutRes(errno: longint);
begin
case errno of
DOSE_NOENT,
DOSE_NODIR,
DOSE_MFILE,
DOSE_ISDIR,
DOSE_BADF,
DOSE_ILGARG,
DOSE_ILGDRV,
DOSE_ISCURDIR:
InOutRes:=-errno;
DOSE_RDONLY:
InOutRes:=105;
DOSE_CANTSEEK:
InOutRes:=156;
else
InOutRes:=word(errno);
end;
end;