sysutilh.inc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 datih.inc}
  16. { Read String Handling functions declaration }
  17. {$i sysstrh.inc}
  18. type
  19. { some helpful data types }
  20. tprocedure = procedure;
  21. tfilename = string;
  22. tsyscharset = set of char;
  23. tintegerset = set of 0..sizeof(integer)*8-1;
  24. longrec = packed record
  25. lo,hi : word;
  26. end;
  27. wordrec = packed record
  28. lo,hi : byte;
  29. end;
  30. TMethod = packed record
  31. Code, Data: Pointer;
  32. end;
  33. { exceptions }
  34. Exception = class(TObject)
  35. private
  36. fmessage : string;
  37. fhelpcontext : longint;
  38. public
  39. constructor Create(const msg : string);
  40. constructor CreateFmt(const msg : string; const args : array of const);
  41. constructor CreateRes(ResString: PString);
  42. constructor CreateResFmt(ResString: PString; const Args: array of const);
  43. constructor CreateHelp(const Msg: string; AHelpContext: Integer);
  44. constructor CreateFmtHelp(const Msg: string; const Args: array of const;
  45. AHelpContext: Integer);
  46. constructor CreateResHelp(ResString: PString; AHelpContext: Integer);
  47. constructor CreateResFmtHelp(ResString: PString; const Args: array of const;
  48. AHelpContext: Integer);
  49. { !!!! }
  50. property helpcontext : longint read fhelpcontext write fhelpcontext;
  51. property message : string read fmessage write fmessage;
  52. end;
  53. ExceptClass = class of Exception;
  54. { integer math exceptions }
  55. EInterror = Class(Exception);
  56. EDivByZero = Class(EIntError);
  57. ERangeError = Class(EIntError);
  58. EIntOverflow = Class(EIntError);
  59. { General math errors }
  60. EMathError = Class(Exception);
  61. EInvalidOp = Class(EMathError);
  62. EZeroDivide = Class(EMathError);
  63. EOverflow = Class(EMathError);
  64. EUnderflow = Class(EMathError);
  65. { Run-time and I/O Errors }
  66. EInOutError = class(Exception)
  67. public
  68. ErrorCode : Longint;
  69. end;
  70. EInvalidPointer = Class(Exception);
  71. EOutOfMemory = Class(Exception);
  72. EAccessViolation = Class(Exception);
  73. EInvalidCast = Class(Exception);
  74. { String conversion errors }
  75. EConvertError = class(Exception);
  76. { Other errors }
  77. EAbort = Class(Exception);
  78. EAbstractError = Class(Exception);
  79. EAssertionFailed = Class(Exception);
  80. { Exception handling routines }
  81. function ExceptObject: TObject;
  82. function ExceptAddr: Pointer;
  83. function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
  84. Buffer: PChar; Size: Integer): Integer;
  85. procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
  86. procedure Abort;
  87. procedure OutOfMemoryError;
  88. procedure Beep;
  89. function SysErrorMessage(ErrorCode: Integer): String;
  90. Var
  91. OnShowException : Procedure (Msg : ShortString);
  92. { FileRec/TextRec }
  93. {$i filerec.inc}
  94. {$i textrec.inc}
  95. Type
  96. TFileRec=FileRec;
  97. TTextRec=TextRec;
  98. { Read internationalization settings }
  99. {$i sysinth.inc}
  100. { Read pchar handling functions declration }
  101. {$i syspchh.inc}
  102. { Read filename handling functions declaration }
  103. {$i finah.inc}
  104. { Read other file handling function declarations }
  105. {$i filutilh.inc}
  106. { Read disk function declarations }
  107. {$i diskh.inc}
  108. {
  109. $Log$
  110. Revision 1.6 2000-12-07 09:15:18 florian
  111. + tintegerset added
  112. Revision 1.5 2000/09/24 21:55:07 peter
  113. * ttextrec,tfilerec added (merged)
  114. Revision 1.4 2000/08/30 18:29:34 hajny
  115. * OS/2 fix - datih.inc moved to the beginning
  116. Revision 1.3 2000/08/29 17:56:32 michael
  117. Merged syserrormsg fix
  118. Revision 1.2 2000/08/20 15:46:46 peter
  119. * sysutils.pp moved to target and merged with disk.inc, filutil.inc
  120. Revision 1.1.2.2 2000/08/22 19:21:48 michael
  121. + Implemented syserrormessage. Made dummies for go32v2 and OS/2
  122. * Changed linux/errors.pp so it uses pchars for storage.
  123. Revision 1.1.2.1 2000/08/20 15:07:36 peter
  124. * sysutils.pp moved into target specific directory and merged
  125. disk.inc and filutil.inc in it
  126. }