libsn.pas 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // LIBSN.H
  2. unit libsn;
  3. interface
  4. {
  5. ** FILESERVER FUNCTIONS:
  6. **
  7. ** NOTE: For PCread and PCwrite do not load files by passing extreme
  8. ** values for count as you might on UNIX as this will cause the full
  9. ** amount specified to be transferred - the file will be padded to
  10. ** that length with zeroes which may over-write memory beyond the
  11. ** end of the file.
  12. **
  13. ** If you are unsure of the length of a file which you are about
  14. ** to read into memory then perform a
  15. ** len = PClseek( fd, 0, 2);
  16. ** This will set len to the length of the file which you can then
  17. ** pass to a PCread() function call.
  18. }
  19. {
  20. ** re-initialise PC filing system, close open files etc
  21. **
  22. ** passed: void
  23. **
  24. ** return: error code (0 if no error)
  25. }
  26. function PCinit: longint; external;
  27. {
  28. ** open a file on PC host
  29. **
  30. ** passed: PC file pathname, open mode, permission flags
  31. **
  32. ** return: file-handle or -1 if error
  33. **
  34. ** note: perms should be zero (it is ignored)
  35. **
  36. ** open mode: 0 => read only
  37. ** 1 => write only
  38. ** 2 => read/write
  39. }
  40. function PCopen(name: pchar; flags, perms: longint): longint; external;
  41. {
  42. ** create (and open) a file on PC host
  43. **
  44. ** passed: PC file pathname, open mode, permission flags
  45. **
  46. ** return: file-handle or -1 if error
  47. **
  48. ** note: perms should be zero (it is ignored)
  49. }
  50. function PCcreat(name: pchar; perms: longint): longint; external;
  51. {
  52. ** seek file pointer to new position in file
  53. **
  54. ** passed: file-handle, seek offset, seek mode
  55. **
  56. ** return: absolute value of new file pointer position
  57. **
  58. ** (mode 0 = rel to start, mode 1 = rel to current fp, mode 2 = rel to end)
  59. }
  60. function PClseek(fd: longint; offset: longint; mode: longint): longint; external;
  61. {
  62. ** read bytes from file on PC
  63. **
  64. ** passed: file-handle, buffer address, count
  65. **
  66. ** return: count of number of bytes actually read
  67. **
  68. ** note: unlike assembler function this provides for full 32 bit count
  69. }
  70. function PCread(fd: longint; buff: pointer; len: longint): longint; external;
  71. {
  72. ** write bytes to file on PC
  73. **
  74. ** passed: file-handle, buffer address, count
  75. **
  76. ** return: count of number of bytes actually written
  77. **
  78. ** note: unlike assembler function this provides for full 32 bit count
  79. }
  80. function PCwrite(fd: longint; buff: pointer; len: longint): longint; external;
  81. {
  82. ** close an open file on PC
  83. **
  84. ** passed: file-handle
  85. **
  86. ** return: negative if error
  87. **
  88. }
  89. function PCclose(fd: longint): longint; external;
  90. implementation
  91. begin
  92. end.