sysutilh.inc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. case integer of
  27. 0 : (lo,hi : word);
  28. 1 : (bytes : array[0..3] of byte);
  29. end;
  30. wordrec = packed record
  31. lo,hi : byte;
  32. end;
  33. int64rec = packed record
  34. case integer of
  35. 0 : (lo,hi : cardinal);
  36. 1 : (words : array[0..3] of word);
  37. 2 : (bytes : array[0..7] of byte);
  38. end;
  39. pbytearray = ^tbytearray;
  40. tbytearray = array[0..32767] of byte;
  41. pwordarray = ^twordarray;
  42. twordarray = array[0..16383] of word;
  43. TMethod = packed record
  44. Code, Data: Pointer;
  45. end;
  46. { exceptions }
  47. Exception = class(TObject)
  48. private
  49. fmessage : string;
  50. fhelpcontext : longint;
  51. public
  52. constructor Create(const msg : string);
  53. constructor CreateFmt(const msg : string; const args : array of const);
  54. constructor CreateRes(ResString: PString);
  55. constructor CreateResFmt(ResString: PString; const Args: array of const);
  56. constructor CreateHelp(const Msg: string; AHelpContext: Integer);
  57. constructor CreateFmtHelp(const Msg: string; const Args: array of const;
  58. AHelpContext: Integer);
  59. constructor CreateResHelp(ResString: PString; AHelpContext: Integer);
  60. constructor CreateResFmtHelp(ResString: PString; const Args: array of const;
  61. AHelpContext: Integer);
  62. { !!!! }
  63. property helpcontext : longint read fhelpcontext write fhelpcontext;
  64. property message : string read fmessage write fmessage;
  65. end;
  66. ExceptClass = class of Exception;
  67. { integer math exceptions }
  68. EInterror = Class(Exception);
  69. EDivByZero = Class(EIntError);
  70. ERangeError = Class(EIntError);
  71. EIntOverflow = Class(EIntError);
  72. { General math errors }
  73. EMathError = Class(Exception);
  74. EInvalidOp = Class(EMathError);
  75. EZeroDivide = Class(EMathError);
  76. EOverflow = Class(EMathError);
  77. EUnderflow = Class(EMathError);
  78. { Run-time and I/O Errors }
  79. EInOutError = class(Exception)
  80. public
  81. ErrorCode : Longint;
  82. end;
  83. EHeapMemoryError = class(Exception)
  84. protected
  85. AllowFree : boolean;
  86. procedure FreeInstance;override;
  87. end;
  88. EInvalidPointer = Class(EHeapMemoryError);
  89. EOutOfMemory = Class(EHeapMemoryError);
  90. EAccessViolation = Class(Exception);
  91. EInvalidCast = Class(Exception);
  92. EVariantError = Class(Exception);
  93. { String conversion errors }
  94. EConvertError = class(Exception);
  95. { Other errors }
  96. EAbort = Class(Exception);
  97. EAbstractError = Class(Exception);
  98. EAssertionFailed = Class(Exception);
  99. { Exception handling routines }
  100. function ExceptObject: TObject;
  101. function ExceptAddr: Pointer;
  102. function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
  103. Buffer: PChar; Size: Integer): Integer;
  104. procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
  105. procedure Abort;
  106. procedure OutOfMemoryError;
  107. procedure Beep;
  108. function SysErrorMessage(ErrorCode: Integer): String;
  109. Var
  110. OnShowException : Procedure (Msg : ShortString);
  111. { FileRec/TextRec }
  112. {$i filerec.inc}
  113. {$i textrec.inc}
  114. Const
  115. HexDisplayPrefix : string = '$';
  116. const
  117. PathDelim=System.DirectorySeparator;
  118. DriveDelim=System.DriveSeparator;
  119. PathSep=System.PathSeparator;
  120. Type
  121. TFileRec=FileRec;
  122. TTextRec=TextRec;
  123. { Read internationalization settings }
  124. {$i sysinth.inc}
  125. { Read pchar handling functions declaration }
  126. {$i syspchh.inc}
  127. { MCBS functions }
  128. {$i sysansih.inc}
  129. { Read filename handling functions declaration }
  130. {$i finah.inc}
  131. { Read other file handling function declarations }
  132. {$i filutilh.inc}
  133. { Read disk function declarations }
  134. {$i diskh.inc}
  135. { read thread handling }
  136. {$i systhrdh.inc}
  137. procedure FreeAndNil(var obj);
  138. {$ifdef HASINTF}
  139. { interface handling }
  140. {$i intfh.inc}
  141. {$endif HASINTF}
  142. {
  143. $Log$
  144. Revision 1.18 2002-10-07 19:43:24 florian
  145. + empty prototypes for the AnsiStr* multi byte functions added
  146. Revision 1.17 2002/09/07 16:01:22 peter
  147. * old logs removed and tabs fixed
  148. Revision 1.16 2002/01/25 17:42:03 peter
  149. * interface helpers
  150. }