typefile.inc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Run time library.
  4. Copyright (c) 1993,97 by the Free Pascal development team
  5. See the File COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {****************************************************************************
  12. subroutines for typed file handling
  13. ****************************************************************************}
  14. {$IFDEF TypedFile}
  15. Procedure assign(var f:TypedFile;const Name:string);
  16. Begin
  17. FillChar(f,SizeOF(FileRec),0);
  18. FileRec(f).Handle:=UnusedHandle;
  19. FileRec(f).mode:=fmClosed;
  20. Move(Name[1],FileRec(f).Name,Length(Name));
  21. End;
  22. {$IFDEF VER_ABOVE0_9_5}
  23. Procedure Intern_Reset(var f : TypedFile;Size : Longint);[Public,IOCheck, Alias: 'RESET_TYPED'];
  24. Begin
  25. Reset(UnTypedFile(f),Size);
  26. End;
  27. Procedure Intern_Rewrite(var f : TypedFile;Size : Longint);[Public,IOCheck, Alias: 'REWRITE_TYPED'];
  28. Begin
  29. Rewrite(UnTypedFile(f),Size);
  30. End;
  31. {$ELSE not VER_ABOVE0_9_5}
  32. Procedure Rewrite(var f : TypedFile);[IOCheck];
  33. Begin
  34. Rewrite(UnTypedFile(f),128);
  35. End;
  36. Procedure Reset(var f : TypedFile);[IOCheck];
  37. Begin
  38. Reset(UnTypedFile(f),128);
  39. End;
  40. {$ENDIF VER_ABOVE0_9_5}
  41. Procedure TypedWrite(TypeSize : Longint;var f : TypedFile;var Buf);[IOCheck, Public, Alias : 'TYPED_WRITE'];
  42. Begin
  43. Do_Write(FileRec(f).Handle,Longint(@Buf),TypeSize);
  44. End;
  45. Procedure TypedRead(TypeSize : Longint;var f : TypedFile;var Buf);[IOCheck, Public, Alias : 'TYPED_READ'];
  46. var
  47. Result : Longint;
  48. Begin
  49. Result:=Do_Read(FileRec(f).Handle,Longint(@Buf),TypeSize);
  50. If Result<TypeSize Then
  51. InOutRes:=100;
  52. End;
  53. {$ENDIF TypedFile }
  54. {
  55. $Log$
  56. Revision 1.1 1998-03-25 11:18:43 root
  57. Initial revision
  58. Revision 1.3 1998/01/26 12:00:33 michael
  59. + Added log at the end
  60. Working file: rtl/inc/typefile.inc
  61. description:
  62. ----------------------------
  63. revision 1.2
  64. date: 1998/01/25 21:53:32; author: peter; state: Exp; lines: +2 -2
  65. + Universal Handles support for StdIn/StdOut/StdErr
  66. * Updated layout of sysamiga.pas
  67. ----------------------------
  68. revision 1.1
  69. date: 1998/01/11 02:43:11; author: michael; state: Exp;
  70. + Initial implementation of these files (by Peter Vreman).
  71. file operations are now in separate files per type of file.
  72. =============================================================================
  73. }