doslib.pp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2004 Karoly Balogh for Genesi S.a.r.l. <www.genesi.lu>
  5. dos.library interface unit for MorphOS/PowerPC
  6. MorphOS port was done on a free Pegasos II/G4 machine
  7. provided by Genesi S.a.r.l. <www.genesi.lu>
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. {$INLINE ON}
  15. unit doslib;
  16. interface
  17. uses Exec, Timer;
  18. var
  19. DosBase: Pointer;
  20. {$include doslibd.inc}
  21. {$include doslibf.inc}
  22. { * dos global definitions (V50)
  23. *********************************************************************
  24. * }
  25. function BADDR(x: LongInt): Pointer; Inline;
  26. function MKBADDR(x: Pointer): LongInt; Inline;
  27. { * dos stdio definitions
  28. *********************************************************************
  29. * }
  30. function ReadChar: LongInt; Inline;
  31. function WriteChar(ch: Char): LongInt; Inline;
  32. function UnReadChar(ch: Char): LongInt; Inline;
  33. function ReadChars(buf: Pointer; num: LongInt): LongInt; Inline;
  34. function dosReadLn(buf: PChar; num: LongInt): PChar; Inline;
  35. function WriteStr(str: PChar): LongInt; Inline;
  36. procedure VWritef(format: PChar; argv: Pointer); Inline;
  37. implementation
  38. { * dos stdio definitions
  39. *********************************************************************
  40. * }
  41. function ReadChar: LongInt; Inline;
  42. begin
  43. ReadChar:=FGetC(dosInput);
  44. end;
  45. function WriteChar(ch: Char): LongInt; Inline;
  46. begin
  47. WriteChar:=FPutC(dosOutput,Byte(ch));
  48. end;
  49. function UnReadChar(ch: Char): LongInt; Inline;
  50. begin
  51. UnReadChar:=UnGetC(dosInput,Byte(ch));
  52. end;
  53. function ReadChars(buf: Pointer; num: LongInt): LongInt; Inline;
  54. begin
  55. ReadChars:=FRead(dosInput,buf,1,num);
  56. end;
  57. function dosReadLn(buf: PChar; num: LongInt): PChar; Inline;
  58. begin
  59. dosReadLn:=FGets(dosInput,buf,num);
  60. end;
  61. function WriteStr(str: PChar): LongInt; Inline;
  62. begin
  63. WriteStr:=FPuts(dosOutput,str);
  64. end;
  65. procedure VWritef(format: PChar; argv: Pointer); Inline;
  66. begin
  67. VFWritef(dosOutput,format,argv);
  68. end;
  69. { * dos global definitions (V50)
  70. *********************************************************************
  71. * }
  72. function BADDR(x: LongInt): Pointer; Inline;
  73. begin
  74. BADDR:=Pointer(x Shl 2);
  75. end;
  76. function MKBADDR(x: Pointer): LongInt; Inline;
  77. begin
  78. MKBADDR:=LongInt(x) Shr 2;
  79. end;
  80. begin
  81. DosBase:=MOS_DOSBase;
  82. end.
  83. {
  84. $Log$
  85. Revision 1.3 2004-08-09 12:57:07 karoly
  86. + added {$INLINE ON} to fix cycle
  87. Revision 1.2 2004/08/09 00:10:19 karoly
  88. + added most of missing stuff
  89. Revision 1.1 2004/06/26 20:46:17 karoly
  90. * initial revision
  91. }