sysutilh.inc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Florian Klaempfl
  5. member of the Free Pascal development team
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. { Read date & Time function declarations }
  13. (* This must be placed before other functions, because TDateTime from DosCalls
  14. would be used under OS/2 instead of that one from datih.inc otherwise. *)
  15. {$i osutilsh.inc}
  16. {$i datih.inc}
  17. { Read String Handling functions declaration }
  18. {$i sysstrh.inc}
  19. type
  20. { some helpful data types }
  21. tprocedure = procedure;
  22. tfilename = string;
  23. tsyscharset = set of char;
  24. tintegerset = set of 0..sizeof(integer)*8-1;
  25. longrec = packed record
  26. lo,hi : word;
  27. end;
  28. wordrec = packed record
  29. lo,hi : byte;
  30. end;
  31. TMethod = packed record
  32. Code, Data: Pointer;
  33. end;
  34. { exceptions }
  35. Exception = class(TObject)
  36. private
  37. fmessage : string;
  38. fhelpcontext : longint;
  39. public
  40. constructor Create(const msg : string);
  41. constructor CreateFmt(const msg : string; const args : array of const);
  42. constructor CreateRes(ResString: PString);
  43. constructor CreateResFmt(ResString: PString; const Args: array of const);
  44. constructor CreateHelp(const Msg: string; AHelpContext: Integer);
  45. constructor CreateFmtHelp(const Msg: string; const Args: array of const;
  46. AHelpContext: Integer);
  47. constructor CreateResHelp(ResString: PString; AHelpContext: Integer);
  48. constructor CreateResFmtHelp(ResString: PString; const Args: array of const;
  49. AHelpContext: Integer);
  50. { !!!! }
  51. property helpcontext : longint read fhelpcontext write fhelpcontext;
  52. property message : string read fmessage write fmessage;
  53. end;
  54. ExceptClass = class of Exception;
  55. { integer math exceptions }
  56. EInterror = Class(Exception);
  57. EDivByZero = Class(EIntError);
  58. ERangeError = Class(EIntError);
  59. EIntOverflow = Class(EIntError);
  60. { General math errors }
  61. EMathError = Class(Exception);
  62. EInvalidOp = Class(EMathError);
  63. EZeroDivide = Class(EMathError);
  64. EOverflow = Class(EMathError);
  65. EUnderflow = Class(EMathError);
  66. { Run-time and I/O Errors }
  67. EInOutError = class(Exception)
  68. public
  69. ErrorCode : Longint;
  70. end;
  71. EInvalidPointer = Class(Exception);
  72. EOutOfMemory = Class(Exception);
  73. EAccessViolation = Class(Exception);
  74. EInvalidCast = Class(Exception);
  75. { String conversion errors }
  76. EConvertError = class(Exception);
  77. { Other errors }
  78. EAbort = Class(Exception);
  79. EAbstractError = Class(Exception);
  80. EAssertionFailed = Class(Exception);
  81. { Exception handling routines }
  82. function ExceptObject: TObject;
  83. function ExceptAddr: Pointer;
  84. function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
  85. Buffer: PChar; Size: Integer): Integer;
  86. procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
  87. procedure Abort;
  88. procedure OutOfMemoryError;
  89. procedure Beep;
  90. function SysErrorMessage(ErrorCode: Integer): String;
  91. Var
  92. OnShowException : Procedure (Msg : ShortString);
  93. { FileRec/TextRec }
  94. {$i filerec.inc}
  95. {$i textrec.inc}
  96. Type
  97. TFileRec=FileRec;
  98. TTextRec=TextRec;
  99. { Read internationalization settings }
  100. {$i sysinth.inc}
  101. { Read pchar handling functions declration }
  102. {$i syspchh.inc}
  103. { Read filename handling functions declaration }
  104. {$i finah.inc}
  105. { Read other file handling function declarations }
  106. {$i filutilh.inc}
  107. { Read disk function declarations }
  108. {$i diskh.inc}
  109. {
  110. $Log$
  111. Revision 1.8 2001-02-20 22:14:19 peter
  112. * merged getenvironmentvariable
  113. Revision 1.7 2001/01/18 22:09:09 michael
  114. + Merged fixes from fixbranch - file modes
  115. Revision 1.6 2000/12/07 09:15:18 florian
  116. + tintegerset added
  117. Revision 1.5 2000/09/24 21:55:07 peter
  118. * ttextrec,tfilerec added (merged)
  119. Revision 1.4 2000/08/30 18:29:34 hajny
  120. * OS/2 fix - datih.inc moved to the beginning
  121. Revision 1.3 2000/08/29 17:56:32 michael
  122. Merged syserrormsg fix
  123. Revision 1.2 2000/08/20 15:46:46 peter
  124. * sysutils.pp moved to target and merged with disk.inc, filutil.inc
  125. Revision 1.1.2.2 2000/08/22 19:21:48 michael
  126. + Implemented syserrormessage. Made dummies for go32v2 and OS/2
  127. * Changed linux/errors.pp so it uses pchars for storage.
  128. Revision 1.1.2.1 2000/08/20 15:07:36 peter
  129. * sysutils.pp moved into target specific directory and merged
  130. disk.inc and filutil.inc in it
  131. }