sysos.inc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2001 by Free Pascal development team
  4. This file implements all the base types and limits required
  5. for a minimal POSIX compliant subset required to port the compiler
  6. to a new OS.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {$i qdos.inc}
  14. {$i sms.inc}
  15. procedure Error2InOutRes(errno: longint);
  16. begin
  17. { Convert QL error code to InOutRes error code. }
  18. case errno of
  19. ERR_NC : InOutRes := 1; { Operation not complete }
  20. ERR_NJ : InOutRes := 1; { Not a (valid) job. }
  21. ERR_OM : InOutRes := 203; { Out of memory. }
  22. ERR_OR : InOutRes := 201; { Out of range. }
  23. ERR_BO : InOutRes := 106; { Buffer overflow. }
  24. ERR_NO : InOutRes := 103; { Channel not open. }
  25. ERR_NF : InOutRes := 2; { File or device not found. }
  26. ERR_FX : InOutRes := 5; { File already exists. }
  27. ERR_IU : InOutRes := 5; { File or device already in use. }
  28. ERR_EF : InOutRes := 100; { End of file. }
  29. ERR_DF : InOutRes := 101; { Drive full. }
  30. ERR_BN : InOutRes := 15; { Bad device. }
  31. ERR_TE : InOutRes := 162; { Transmission error. }
  32. ERR_FF : InOutRes := 152; { Format failed. }
  33. ERR_BP : InOutRes := 218; { Bad parameter. }
  34. ERR_FE : InOutRes := 5; { File error. }
  35. ERR_EX : InOutRes := 106; { Expression error. }
  36. ERR_OV : InOutRes := 215; { Arithmetic overflow. }
  37. ERR_NI : InOutRes := 1; { Not implemented. }
  38. ERR_RO : InOutRes := 150; { Read only. }
  39. ERR_BL : InOutRes := 1; { UNLIKELY! Bad line of Basic. }
  40. end;
  41. end;
  42. var
  43. stackpointer_on_entry: pointer; external name '__stackpointer_on_entry';
  44. function StackTop: Pointer;
  45. begin
  46. StackTop:=stackpointer_on_entry;
  47. end;
  48. var
  49. binstart: byte; external name '_stext';
  50. binend: byte; external name '_etext';
  51. function SysBackTraceStr (Addr: CodePointer): ShortString;
  52. begin
  53. if (addr<@binstart) or (addr>@binend) then
  54. SysBackTraceStr:=' Addr $'+hexstr(addr)
  55. else
  56. SysBackTraceStr:=' Offs $'+hexstr(pointer(addr-@binstart));
  57. end;