sysutilh.inc 4.5 KB

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