2
0

sysfile.inc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2005 by Free Pascal development team
  4. Low level file functions
  5. GBA does not have any drive, so no file handling is needed.
  6. Copyright (c) 2006 by Francesco Lombardi
  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. {****************************************************************************
  14. Low level File Routines
  15. All these functions can set InOutRes on errors
  16. ****************************************************************************}
  17. { close a file from the handle value }
  18. procedure do_close(handle : longint);
  19. begin
  20. if assigned (@rtl_do_close) then
  21. rtl_do_close(handle);
  22. end;
  23. procedure do_erase(p : PAnsiChar; pchangeable: boolean);
  24. begin
  25. if assigned (@rtl_do_erase) then
  26. rtl_do_erase(p);
  27. end;
  28. procedure do_rename(p1,p2 : PAnsiChar; p1changeable, p2changeable: boolean);
  29. begin
  30. if assigned (@rtl_do_rename) then
  31. rtl_do_rename(p1, p2);
  32. end;
  33. function do_write(h: longint; addr: pointer; len: longint) : longint;
  34. begin
  35. if assigned (rtl_do_write) then
  36. result := rtl_do_write(h, addr, len)
  37. else
  38. result := -1;
  39. end;
  40. function do_read(h: longint; addr: pointer; len: longint) : longint;
  41. begin
  42. if assigned (rtl_do_read) then
  43. result := rtl_do_read(h, addr, len)
  44. else
  45. result := -1;
  46. end;
  47. function do_filepos(handle: longint) : longint;
  48. begin
  49. if assigned (rtl_do_filepos) then
  50. result := rtl_do_filepos(handle)
  51. else
  52. result := -1;
  53. end;
  54. procedure do_seek(handle, pos: longint);
  55. begin
  56. if assigned (rtl_do_seek) then
  57. rtl_do_seek(handle, pos);
  58. end;
  59. function do_seekend(handle: longint):longint;
  60. begin
  61. if assigned (rtl_do_seekend) then
  62. result := rtl_do_seekend(handle)
  63. else
  64. result := -1;
  65. end;
  66. function do_filesize(handle : longint) : longint;
  67. begin
  68. result := -1;
  69. if assigned (rtl_do_filesize) then
  70. result := rtl_do_filesize(handle);
  71. end;
  72. { truncate at a given position }
  73. procedure do_truncate(handle, pos: longint);
  74. begin
  75. if assigned (rtl_do_truncate) then
  76. rtl_do_truncate(handle, pos);
  77. end;
  78. procedure do_open(var f;p:PFileTextRecChar;flags:longint; pchangeable: boolean);
  79. begin
  80. if assigned (rtl_do_open) then
  81. rtl_do_open(f, p, flags);
  82. end;
  83. function do_isdevice(handle: THandle): boolean;
  84. begin
  85. result := false;
  86. if assigned (rtl_do_isdevice) then
  87. result := rtl_do_isdevice(handle);
  88. end;