systemh.inc 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. This File contains the OS independent declarations of the system unit
  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. {****************************************************************************
  13. Needed switches
  14. ****************************************************************************}
  15. {$I-,Q-,H-,R-,V-}
  16. {$mode objfpc}
  17. { Using inlining for small system functions/wrappers }
  18. {$ifdef HASINLINE}
  19. {$inline on}
  20. {$define SYSTEMINLINE}
  21. {$endif}
  22. { Use threadvars when the compiler supports it }
  23. {$ifdef HASTHREADVAR}
  24. {$define SUPPORT_THREADVAR}
  25. {$endif HASTHREADVAR}
  26. { don't use FPU registervariables on the i386 }
  27. {$ifdef CPUI386}
  28. {$maxfpuregisters 0}
  29. {$endif CPUI386}
  30. { the assembler helpers need this }
  31. {$ifdef POWERPC}
  32. {$goto+}
  33. {$endif POWERPC}
  34. { needed for insert,delete,readln }
  35. {$P+}
  36. { stack checking always disabled
  37. for system unit. This is because
  38. the startup code might not
  39. have been called yet when we
  40. get a stack error, this will
  41. cause big crashes
  42. }
  43. {$S-}
  44. {****************************************************************************
  45. Global Types and Constants
  46. ****************************************************************************}
  47. Type
  48. {$Ifdef HAS_INTERNAL_INTTYPES}
  49. { The compiler has all integer types defined internally. Here
  50. we define only aliases }
  51. DWord = LongWord;
  52. Cardinal = LongWord;
  53. Integer = SmallInt;
  54. {$else HAS_INTERNAL_INTTYPES}
  55. ShortInt = -128..127;
  56. SmallInt = -32768..32767;
  57. { can't use -2147483648 because of a bug in 1.0.2's val() procedure (JM) }
  58. Longint = +(-2147483647-1)..$7fffffff;
  59. Byte = 0..255;
  60. Word = 0..65535;
  61. {$ifndef ver1_0}
  62. DWord = LongWord;
  63. Cardinal = LongWord;
  64. {$else}
  65. Longword = cardinal;
  66. Dword = cardinal;
  67. {$endif}
  68. Integer = SmallInt;
  69. {$endif HAS_INTERNAL_INTTYPES}
  70. {$ifdef CPUI386}
  71. { for bootstrapping with 1.0.x }
  72. {$define CPU32}
  73. {$define DEFAULT_EXTENDED}
  74. {$define SUPPORT_SINGLE}
  75. {$define SUPPORT_DOUBLE}
  76. {$define SUPPORT_EXTENDED}
  77. {$define SUPPORT_COMP}
  78. ValReal = Extended;
  79. {$endif CPUI386}
  80. {$ifdef CPUX86_64}
  81. {$define DEFAULT_EXTENDED}
  82. {$define SUPPORT_SINGLE}
  83. {$define SUPPORT_DOUBLE}
  84. {$define SUPPORT_EXTENDED}
  85. {$define SUPPORT_COMP}
  86. ValReal = Extended;
  87. {$endif CPUX86_64}
  88. {$ifdef CPUM68K}
  89. ValReal = Real;
  90. {$define SUPPORT_SINGLE}
  91. {$IFDEF Unix}
  92. { Linux FPU emulator will be used }
  93. {$define SUPPORT_DOUBLE}
  94. {$ENDIF}
  95. {$IFOPT E-}
  96. { If not compiling with emulation }
  97. { then support double type. }
  98. {$define SUPPORT_DOUBLE}
  99. {$ENDIF}
  100. { Comp type does not exist on fpu }
  101. Comp = int64;
  102. PComp = ^Comp;
  103. {$endif CPUM68K}
  104. {$ifdef CPUPOWERPC}
  105. {$define DEFAULT_DOUBLE}
  106. {$define SUPPORT_SINGLE}
  107. {$define SUPPORT_DOUBLE}
  108. {$define FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
  109. ValReal = Double;
  110. { map comp to int64, but this doesn't mean we compile the comp support in! }
  111. Comp = Int64;
  112. PComp = ^Comp;
  113. {$endif CPUPOWERPC}
  114. {$ifdef CPUSPARC}
  115. {$define DEFAULT_DOUBLE}
  116. {$define SUPPORT_SINGLE}
  117. {$define SUPPORT_DOUBLE}
  118. {$define FPC_INCLUDE_SOFTWARE_SHIFT_INT64}
  119. ValReal = Double;
  120. { map comp to int64, but this doesn't mean we compile the comp support in! }
  121. Comp = Int64;
  122. PComp = ^Comp;
  123. {$endif CPUSPARC}
  124. {$ifdef CPUARM}
  125. {$define DEFAULT_DOUBLE}
  126. {$define SUPPORT_SINGLE}
  127. {$define SUPPORT_DOUBLE}
  128. {$define FPC_INCLUDE_SOFTWARE_MOD_DIV}
  129. {$define FPC_INCLUDE_SOFTWARE_SHIFT_INT64}
  130. {$define FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE}
  131. ValReal = Real;
  132. { map comp to int64, but this doesn't mean we compile the comp support in! }
  133. Comp = Int64;
  134. PComp = ^Comp;
  135. {$endif CPUARM}
  136. {$ifdef CPU64}
  137. SizeInt = Int64;
  138. SizeUInt = QWord;
  139. PtrInt = Int64;
  140. PtrUInt = QWord;
  141. ValSInt = int64;
  142. ValUInt = qword;
  143. {$endif CPU64}
  144. {$ifdef CPU32}
  145. SizeInt = Longint;
  146. SizeUInt = DWord;
  147. PtrInt = Longint;
  148. PtrUInt = DWord;
  149. ValSInt = Longint;
  150. ValUInt = Cardinal;
  151. {$endif CPU32}
  152. { Zero - terminated strings }
  153. PChar = ^Char;
  154. PPChar = ^PChar;
  155. { AnsiChar is equivalent of Char, so we need
  156. to use type renamings }
  157. TAnsiChar = Char;
  158. AnsiChar = Char;
  159. PAnsiChar = PChar;
  160. PPAnsiChar = PPChar;
  161. UCS4Char = type LongWord;
  162. PUCS4Char = ^UCS4Char;
  163. TUCS4CharArray = array[0..$effffff] of UCS4Char;
  164. PUCS4CharArray = ^TUCS4CharArray;
  165. {$ifndef VER1_0}
  166. UCS4String = array of UCS4Char;
  167. {$endif VER1_0}
  168. UTF8String = type ansistring;
  169. PUTF8String = ^UTF8String;
  170. {$ifndef HASCURRENCY}
  171. Currency = Int64;
  172. {$endif HASCURRENCY}
  173. HRESULT = type Longint;
  174. TDateTime = type Double;
  175. Error = type Longint;
  176. PSingle = ^Single;
  177. PDouble = ^Double;
  178. PCurrency = ^Currency;
  179. {$ifdef SUPPORT_COMP}
  180. PComp = ^Comp;
  181. {$endif SUPPORT_COMP}
  182. PExtended = ^Extended;
  183. PSmallInt = ^Smallint;
  184. PShortInt = ^Shortint;
  185. PInteger = ^Longint;
  186. PByte = ^Byte;
  187. PWord = ^word;
  188. PDWord = ^DWord;
  189. PLongWord = ^LongWord;
  190. PLongint = ^Longint;
  191. PCardinal = ^Cardinal;
  192. PQWord = ^QWord;
  193. PInt64 = ^Int64;
  194. PPtrInt = ^PtrInt;
  195. PSizeInt = ^SizeInt;
  196. PPointer = ^Pointer;
  197. PPPointer = ^PPointer;
  198. PBoolean = ^Boolean;
  199. PWordBool = ^WordBool;
  200. PLongBool = ^LongBool;
  201. PShortString = ^ShortString;
  202. PAnsiString = ^AnsiString;
  203. PDate = ^TDateTime;
  204. PError = ^Error;
  205. {$ifdef HASVARIANT}
  206. PVariant = ^Variant;
  207. POleVariant = ^OleVariant;
  208. {$endif HASVARIANT}
  209. {$ifdef HASWIDECHAR}
  210. PWideChar = ^WideChar;
  211. PPWideChar = ^PWideChar;
  212. { 1.0.x also has HASWIDECHAR defined, but doesn't support it
  213. fully, setting WChar to Word as fallback (PFV) }
  214. {$ifndef VER1_0}
  215. WChar = Widechar;
  216. {$else}
  217. WChar = Word;
  218. {$endif}
  219. UCS2Char = WideChar;
  220. PUCS2Char = PWideChar;
  221. {$else}
  222. WChar = Word;
  223. {$endif HASWIDECHAR}
  224. {$ifdef HASWIDESTRING}
  225. PWideString = ^WideString;
  226. {$endif HASWIDESTRING}
  227. { Needed for fpc_get_output }
  228. PText = ^Text;
  229. TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
  230. { procedure type }
  231. TProcedure = Procedure;
  232. const
  233. { Maximum value of the biggest signed and unsigned integer type available}
  234. MaxSIntValue = High(ValSInt);
  235. MaxUIntValue = High(ValUInt);
  236. { max. values for longint and int}
  237. maxLongint = $7fffffff;
  238. maxSmallint = 32767;
  239. maxint = maxsmallint;
  240. type
  241. IntegerArray = array[0..$effffff] of Integer;
  242. PIntegerArray = ^IntegerArray;
  243. PointerArray = array [0..512*1024*1024 - 2] of Pointer;
  244. PPointerArray = ^PointerArray;
  245. {$ifndef VER1_0}
  246. TBoundArray = array of Integer;
  247. {$endif VER1_0}
  248. TPCharArray = packed array[0..(MaxLongint div SizeOf(PChar))-1] of PChar;
  249. PPCharArray = ^TPCharArray;
  250. const
  251. {$ifdef cpui386}
  252. Test8086 : byte = 2; { Always i386 or newer }
  253. Test8087 : byte = 3; { Always 387 or newer. Emulated if needed. }
  254. {$endif cpui386}
  255. {$ifdef cpum68k}
  256. Test68000 : byte = 0; { Must be determined at startup for both }
  257. Test68881 : byte = 0;
  258. {$endif cpum68k}
  259. { max level in dumping on error }
  260. Max_Frame_Dump : Word = 8;
  261. { Exit Procedure handling consts and types }
  262. ExitProc : pointer = nil;
  263. Erroraddr: pointer = nil;
  264. Errorcode: Word = 0;
  265. { file input modes }
  266. fmClosed = $D7B0;
  267. fmInput = $D7B1;
  268. fmOutput = $D7B2;
  269. fmInOut = $D7B3;
  270. fmAppend = $D7B4;
  271. Filemode : byte = 2;
  272. CmdLine : PChar = nil;
  273. (* Value should be changed during system initialization as appropriate. *)
  274. { assume that this program will not spawn other threads, when the
  275. first thread is started the following constants need to be filled }
  276. IsMultiThread : boolean = FALSE;
  277. { Indicates if there was an error }
  278. StackError : boolean = FALSE;
  279. var
  280. ExitCode : Word; public name 'operatingsystem_result';
  281. RandSeed : Cardinal;
  282. { Delphi compatibility }
  283. IsLibrary : boolean;
  284. IsConsole : boolean;
  285. { Threading support }
  286. fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';
  287. {$ifdef SUPPORT_THREADVAR}
  288. ThreadVar
  289. {$else SUPPORT_THREADVAR}
  290. Var
  291. {$endif SUPPORT_THREADVAR}
  292. ThreadID : SizeUInt;
  293. { Standard In- and Output }
  294. ErrOutput,
  295. Output,
  296. Input,
  297. StdOut,
  298. StdErr : Text;
  299. InOutRes : Word;
  300. { Stack checking }
  301. StackBottom : Pointer;
  302. StackLength : Cardinal;
  303. { Numbers for routines that have compiler magic }
  304. {$I innr.inc}
  305. {****************************************************************************
  306. Processor specific routines
  307. ****************************************************************************}
  308. {$ifdef FPC_USE_LIBC}
  309. {$ifdef SYSTEMINLINE}
  310. {$define INLINEGENERICS}
  311. {$endif}
  312. {$endif}
  313. Procedure Move(const source;var dest;count:SizeInt);{$ifdef INLINEGENERICS}inline;{$endif}
  314. Procedure FillChar(Var x;count:SizeInt;Value:Boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
  315. Procedure FillChar(Var x;count:SizeInt;Value:Char);{$ifdef SYSTEMINLINE}inline;{$endif}
  316. Procedure FillChar(Var x;count:SizeInt;Value:Byte);{$ifdef INLINEGENERICS}inline;{$endif}
  317. procedure FillByte(var x;count:SizeInt;value:byte);{$ifdef INLINEGENERICS}inline;{$endif}
  318. Procedure FillWord(Var x;count:SizeInt;Value:Word);
  319. procedure FillDWord(var x;count:SizeInt;value:DWord);
  320. function IndexChar(const buf;len:SizeInt;b:char):SizeInt;
  321. function IndexByte(const buf;len:SizeInt;b:byte):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
  322. function Indexword(const buf;len:SizeInt;b:word):SizeInt;
  323. function IndexDWord(const buf;len:SizeInt;b:DWord):SizeInt;
  324. function CompareChar(const buf1,buf2;len:SizeInt):SizeInt;
  325. function CompareByte(const buf1,buf2;len:SizeInt):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
  326. function CompareWord(const buf1,buf2;len:SizeInt):SizeInt;
  327. function CompareDWord(const buf1,buf2;len:SizeInt):SizeInt;
  328. procedure MoveChar0(const buf1;var buf2;len:SizeInt);
  329. function IndexChar0(const buf;len:SizeInt;b:char):SizeInt;
  330. function CompareChar0(const buf1,buf2;len:SizeInt):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
  331. procedure prefetch(const mem);{$ifdef INTERNCONSTINTF}[internproc:fpc_in_prefetch_var];{$endif}
  332. {****************************************************************************
  333. Math Routines
  334. ****************************************************************************}
  335. Function lo(B: Byte):Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
  336. Function hi(b : Byte) : Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
  337. Function lo(i : Integer) : byte; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_Word];{$endif}
  338. Function lo(w : Word) : byte; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_Word];{$endif}
  339. Function lo(l : Longint) : Word; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_long];{$endif}
  340. Function lo(l : DWord) : Word; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_long];{$endif}
  341. Function lo(i : Int64) : DWord; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_qword];{$endif}
  342. Function lo(q : QWord) : DWord; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_qword];{$endif}
  343. Function hi(i : Integer) : byte; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_Word];{$endif}
  344. Function hi(w : Word) : byte; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_Word];{$endif}
  345. Function hi(l : Longint) : Word; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_long];{$endif}
  346. Function hi(l : DWord) : Word; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_long];{$endif}
  347. Function hi(i : Int64) : DWord; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_qword];{$endif}
  348. Function hi(q : QWord) : DWord; {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_qword];{$endif}
  349. Function swap (X : Word) : Word;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_word];{$endif}
  350. Function Swap (X : Integer) : Integer;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_word];{$endif}
  351. Function swap (X : Longint) : Longint;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_long];{$endif}
  352. Function Swap (X : Cardinal) : Cardinal;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_long];{$endif}
  353. Function Swap (X : QWord) : QWord;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_qword];{$endif}
  354. Function swap (X : Int64) : Int64;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_qword];{$endif}
  355. Function Align (Addr : PtrInt; Alignment : PtrInt) : PtrInt;{$ifdef SYSTEMINLINE}inline;{$endif}
  356. Function Align (Addr : Pointer; Alignment : PtrInt) : Pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
  357. Function Random(l:longint):longint;
  358. Function Random(l:int64):int64;
  359. Function Random: extended;
  360. Procedure Randomize;
  361. Function abs(l:Longint):Longint;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_abs];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  362. Function abs(l:Int64):Int64;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_abs];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  363. Function sqr(l:Longint):Longint;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  364. Function sqr(l:Int64):Int64;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  365. Function sqr(l:QWord):QWord;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  366. Function odd(l:Longint):Boolean;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  367. Function odd(l:Longword):Boolean;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  368. Function odd(l:Int64):Boolean;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  369. Function odd(l:QWord):Boolean;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  370. { float math routines }
  371. {$I mathh.inc}
  372. operator ** (bas,expo : real) e: real;
  373. operator ** (bas,expo : int64) i: int64;
  374. {****************************************************************************
  375. Addr/Pointer Handling
  376. ****************************************************************************}
  377. Function ptr(sel,off:Longint):farpointer;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_ptr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
  378. Function Cseg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
  379. Function Dseg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
  380. Function Sseg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
  381. {****************************************************************************
  382. PChar and String Handling
  383. ****************************************************************************}
  384. function strpas(p:pchar):shortstring;external name 'FPC_PCHAR_TO_SHORTSTR';
  385. function strlen(p:pchar):longint;external name 'FPC_PCHAR_LENGTH';
  386. { Shortstring functions }
  387. {$ifndef INTERNSETLENGTH}
  388. Procedure SetLength (Var S:ShortString;len:SizeInt);
  389. {$endif INTERNSETLENGTH}
  390. {$ifndef InternCopy}
  391. Function Copy(const s:shortstring;index:SizeInt;count:SizeInt):shortstring;
  392. {$endif interncopy}
  393. Procedure Delete(Var s:shortstring;index:SizeInt;count:SizeInt);
  394. Procedure Insert(const source:shortstring;Var s:shortstring;index:SizeInt);
  395. Procedure Insert(source:Char;Var s:shortstring;index:SizeInt);
  396. Function Pos(const substr:shortstring;const s:shortstring):SizeInt;
  397. Function Pos(C:Char;const s:shortstring):SizeInt;
  398. Procedure SetString (Var S : Shortstring; Buf : PChar; Len : SizeInt);
  399. Procedure SetString (Var S : AnsiString; Buf : PChar; Len : SizeInt);
  400. {$ifndef INTERNLENGTH}
  401. Function Length(s:string):byte;
  402. {$endif INTERNLENGTH}
  403. Function upCase(const s:shortstring):shortstring;
  404. Function lowerCase(const s:shortstring):shortstring; overload;
  405. Function Space(b:byte):shortstring;
  406. Function hexStr(Val:Longint;cnt:byte):shortstring;
  407. Function OctStr(Val:Longint;cnt:byte):shortstring;
  408. Function binStr(Val:Longint;cnt:byte):shortstring;
  409. Function hexStr(Val:int64;cnt:byte):shortstring;
  410. Function OctStr(Val:int64;cnt:byte):shortstring;
  411. Function binStr(Val:int64;cnt:byte):shortstring;
  412. { Char functions }
  413. {$ifdef INTERNCONSTINTF}
  414. Function chr(b : byte) : Char; [INTERNPROC: fpc_in_chr_byte];
  415. {$else}
  416. Function Chr(b:byte):Char;
  417. {$endif}
  418. Function upCase(c:Char):Char;
  419. Function lowerCase(c:Char):Char; overload;
  420. {$ifndef InternCopy}
  421. function copy(c:char;index : SizeInt;count : SizeInt): shortstring;
  422. {$endif interncopy}
  423. function pos(const substr : shortstring;c:char): SizeInt;
  424. {$ifndef INTERNLENGTH}
  425. function length(c:char):byte;
  426. {$endif INTERNLENGTH}
  427. {****************************************************************************
  428. AnsiString Handling
  429. ****************************************************************************}
  430. {$ifndef INTERNSETLENGTH}
  431. Procedure SetLength (Var S : AnsiString; l : SizeInt);
  432. {$endif INTERNSETLENGTH}
  433. Procedure UniqueString(Var S : AnsiString);external name 'FPC_ANSISTR_UNIQUE';
  434. {$ifndef INTERNLENGTH}
  435. Function Length (Const S : AnsiString) : SizeInt;
  436. {$endif INTERNLENGTH}
  437. {$ifndef InternCopy}
  438. Function Copy (Const S : AnsiString; Index,Size : SizeInt) : AnsiString;
  439. {$endif interncopy}
  440. Function Pos (Const Substr : AnsiString; Const Source : AnsiString) : SizeInt;
  441. Function Pos (c : Char; Const s : AnsiString) : SizeInt;
  442. Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : SizeInt);
  443. Procedure Delete (Var S : AnsiString; Index,Size: SizeInt);
  444. Function StringOfChar(c : char;l : SizeInt) : AnsiString;
  445. function upcase(const s : ansistring) : ansistring;
  446. function lowercase(const s : ansistring) : ansistring;
  447. {****************************************************************************
  448. WideString Handling
  449. ****************************************************************************}
  450. {$ifdef HASWIDESTRING}
  451. {$ifndef INTERNSETLENGTH}
  452. Procedure SetLength (Var S : WideString; l : SizeInt);
  453. {$endif INTERNSETLENGTH}
  454. procedure UniqueString(Var S : WideString);external name 'FPC_WIDESTR_UNIQUE';
  455. {$ifndef INTERNLENGTH}
  456. Function Length (Const S : WideString) : SizeInt;
  457. {$endif INTERNLENGTH}
  458. {$ifndef InternCopy}
  459. Function Copy (Const S : WideString; Index,Size : SizeInt) : WideString;
  460. {$endif interncopy}
  461. Function Pos (Const Substr : WideString; Const Source : WideString) : SizeInt;
  462. Function Pos (c : Char; Const s : WideString) : SizeInt;
  463. Function Pos (c : WideChar; Const s : WideString) : SizeInt;
  464. Procedure Insert (Const Source : WideString; Var S : WideString; Index : SizeInt);
  465. Procedure Delete (Var S : WideString; Index,Size: SizeInt);
  466. Procedure SetString (Var S : WideString; Buf : PWideChar; Len : SizeInt);
  467. Procedure SetString (Var S : WideString; Buf : PChar; Len : SizeInt);
  468. function WideCharToString(S : PWideChar) : AnsiString;
  469. function StringToWideChar(const Src : AnsiString;Dest : PWideChar;DestSize : SizeInt) : PWideChar;
  470. function WideCharLenToString(S : PWideChar;Len : SizeInt) : AnsiString;
  471. procedure WideCharLenToStrVar(Src : PWideChar;Len : SizeInt;var Dest : AnsiString);
  472. procedure WideCharToStrVar(S : PWideChar;var Dest : AnsiString);
  473. Type
  474. TWide2AnsiMove=procedure(source:pwidechar;dest:pchar;len:SizeInt);
  475. TAnsi2WideMove=procedure(source:pchar;dest:pwidechar;len:SizeInt);
  476. TWideStringManager = record
  477. Wide2AnsiMove : TWide2AnsiMove;
  478. Ansi2WideMove : TAnsi2WideMove;
  479. {
  480. UpperUTF8 : procedure(p:PUTF8String);
  481. UpperUCS2 : procedure(p:PUCS2Char);
  482. UpperUCS4 : procedure(p:PUCS4Char);
  483. LowerUTF8 : procedure(p:PUTF8String);
  484. LowerUCS2 : procedure(p:PUCS2Char);
  485. LowerUCS4 : procedure(p:PUCS4Char);
  486. CompUTF8 : function(p1,p2:PUTF8String) : shortint;
  487. CompUCS2 : function(p1,p2:PUCS2Char) : shortint;
  488. CompUCS4 : function(p1,p2:PUC42Char) : shortint;
  489. }
  490. end;
  491. function UnicodeToUtf8(Dest: PChar; Source: PWideChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
  492. function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PWideChar; SourceChars: SizeUInt): SizeUInt;
  493. function Utf8ToUnicode(Dest: PWideChar; Source: PChar; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
  494. function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: SizeUInt; Source: PChar; SourceBytes: SizeUInt): SizeUInt;
  495. function UTF8Encode(const s : WideString) : UTF8String;
  496. function UTF8Decode(const s : UTF8String): WideString;
  497. function AnsiToUtf8(const s : ansistring): UTF8String;{$ifdef SYSTEMINLINE}inline;{$endif}
  498. function Utf8ToAnsi(const s : UTF8String) : ansistring;{$ifdef SYSTEMINLINE}inline;{$endif}
  499. Procedure GetWideStringManager (Var Manager : TWideStringManager);
  500. Procedure SetWideStringManager (Const New : TWideStringManager);
  501. Procedure SetWideStringManager (Const New : TWideStringManager; Var Old: TWideStringManager);
  502. {$endif HASWIDESTRING}
  503. {****************************************************************************
  504. Untyped File Management
  505. ****************************************************************************}
  506. Procedure Assign(Var f:File;const Name:string);
  507. Procedure Assign(Var f:File;p:pchar);
  508. Procedure Assign(Var f:File;c:char);
  509. Procedure Rewrite(Var f:File;l:Longint);
  510. Procedure Rewrite(Var f:File);
  511. Procedure Reset(Var f:File;l:Longint);
  512. Procedure Reset(Var f:File);
  513. Procedure Close(Var f:File);
  514. Procedure BlockWrite(Var f:File;Const Buf;Count:Longint;Var Result:Longint);
  515. Procedure BlockWrite(Var f:File;Const Buf;Count:Cardinal;var Result:Cardinal);
  516. Procedure BlockWrite(Var f:File;Const Buf;Count:Word;Var Result:Word);
  517. Procedure BlockWrite(Var f:File;Const Buf;Count:Word;Var Result:Integer);
  518. Procedure BlockWrite(Var f:File;Const Buf;Count:Longint);
  519. Procedure BlockRead(Var f:File;Var Buf;count:Longint;Var Result:Longint);
  520. Procedure BlockRead(Var f:File;Var Buf;count:Cardinal;Var Result:Cardinal);
  521. Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Word);
  522. Procedure BlockRead(Var f:File;Var Buf;count:Word;Var Result:Integer);
  523. Procedure BlockRead(Var f:File;Var Buf;count:Longint);
  524. Function FilePos(Var f:File):Longint;
  525. Function FileSize(Var f:File):Longint;
  526. Procedure Seek(Var f:File;Pos:Longint);
  527. Function EOF(Var f:File):Boolean;
  528. Procedure Erase(Var f:File);
  529. Procedure Rename(Var f:File;const s:string);
  530. Procedure Rename(Var f:File;p:pchar);
  531. Procedure Rename(Var f:File;c:char);
  532. Procedure Truncate (Var F:File);
  533. {****************************************************************************
  534. Typed File Management
  535. ****************************************************************************}
  536. Procedure Assign(Var f:TypedFile;const Name:string);
  537. Procedure Assign(Var f:TypedFile;p:pchar);
  538. Procedure Assign(Var f:TypedFile;c:char);
  539. {$ifdef INTERNCONSTINTF}
  540. Procedure Reset(var f : TypedFile); [INTERNPROC: fpc_in_Reset_TypedFile];
  541. Procedure Rewrite(var f : TypedFile); [INTERNPROC: fpc_in_Rewrite_TypedFile];
  542. {$else}
  543. Procedure Rewrite(Var f:TypedFile);
  544. Procedure Reset(Var f:TypedFile);
  545. {$endif}
  546. {****************************************************************************
  547. Text File Management
  548. ****************************************************************************}
  549. Procedure Assign(Var t:Text;const s:string);
  550. Procedure Assign(Var t:Text;p:pchar);
  551. Procedure Assign(Var t:Text;c:char);
  552. Procedure Close(Var t:Text);
  553. Procedure Rewrite(Var t:Text);
  554. Procedure Reset(Var t:Text);
  555. Procedure Append(Var t:Text);
  556. Procedure Flush(Var t:Text);
  557. Procedure Erase(Var t:Text);
  558. Procedure Rename(Var t:Text;const s:string);
  559. Procedure Rename(Var t:Text;p:pchar);
  560. Procedure Rename(Var t:Text;c:char);
  561. Function EOF(Var t:Text):Boolean;
  562. Function EOF:Boolean;
  563. Function EOLn(Var t:Text):Boolean;
  564. Function EOLn:Boolean;
  565. Function SeekEOLn (Var t:Text):Boolean;
  566. Function SeekEOF (Var t:Text):Boolean;
  567. Function SeekEOLn:Boolean;
  568. Function SeekEOF:Boolean;
  569. Procedure SetTextBuf(Var f:Text; Var Buf);{$ifdef INTERNCONSTINTF}[INTERNPROC:fpc_in_settextbuf_file_x];{$endif}
  570. Procedure SetTextBuf(Var f:Text; Var Buf; Size:Longint);
  571. Procedure SetTextLineEnding(Var f:Text; Ending:string);
  572. {****************************************************************************
  573. Directory Management
  574. ****************************************************************************}
  575. Procedure chdir(const s:string);
  576. Procedure mkdir(const s:string);
  577. Procedure rmdir(const s:string);
  578. Procedure getdir(drivenr:byte;Var dir:shortstring);
  579. Procedure getdir(drivenr:byte;Var dir:ansistring);
  580. {*****************************************************************************
  581. Miscellaneous
  582. *****************************************************************************}
  583. { os independent calls to allow backtraces }
  584. function get_frame:pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
  585. function get_caller_addr(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
  586. function get_caller_frame(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
  587. Function IOResult:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
  588. Function Sptr:Pointer;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_ptr];{$endif}
  589. Function GetProcessID:SizeUInt;
  590. Function GetThreadID:SizeUInt;
  591. {*****************************************************************************
  592. Init / Exit / ExitProc
  593. *****************************************************************************}
  594. Function Paramcount:Longint;
  595. Function ParamStr(l:Longint):string;
  596. Procedure Dump_Stack(var f : text;bp:pointer);
  597. Procedure RunError(w:Word);
  598. Procedure RunError;{$ifdef SYSTEMINLINE}inline;{$endif}
  599. Procedure halt(errnum:byte);
  600. Procedure AddExitProc(Proc:TProcedure);
  601. Procedure halt;{$ifdef SYSTEMINLINE}inline;{$endif}
  602. { Need to be exported for threads unit }
  603. Procedure SysInitExceptions;
  604. procedure SysInitStdIO;
  605. Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
  606. {*****************************************************************************
  607. Abstract/Assert/Error Handling
  608. *****************************************************************************}
  609. function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint):ppchar; // const ?
  610. Function StringToPPChar(Var S:AnsiString;ReserveEntries:integer):ppchar;
  611. Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
  612. procedure AbstractError;external name 'FPC_ABSTRACTERROR';
  613. Function SysBackTraceStr(Addr:Pointer): ShortString;
  614. Procedure SysAssert(Const Msg,FName:ShortString;LineNo:Longint;ErrorAddr:Pointer);
  615. { Error handlers }
  616. Type
  617. TBackTraceStrFunc = Function (Addr: Pointer): ShortString;
  618. TErrorProc = Procedure (ErrNo : Longint; Address,Frame : Pointer);
  619. TAbstractErrorProc = Procedure;
  620. TAssertErrorProc = Procedure(const msg,fname:ShortString;lineno:longint;erroraddr:pointer);
  621. const
  622. BackTraceStrFunc : TBackTraceStrFunc = @SysBackTraceStr;
  623. ErrorProc : TErrorProc = nil;
  624. AbstractErrorProc : TAbstractErrorProc = nil;
  625. AssertErrorProc : TAssertErrorProc = @SysAssert;
  626. {*****************************************************************************
  627. SetJmp/LongJmp
  628. *****************************************************************************}
  629. {$i setjumph.inc}
  630. {*****************************************************************************
  631. Object Pascal support
  632. *****************************************************************************}
  633. {$i objpash.inc}
  634. {*****************************************************************************
  635. Variant support
  636. *****************************************************************************}
  637. {$ifdef HASVARIANT}
  638. {$i varianth.inc}
  639. {$endif HASVARIANT}
  640. {*****************************************************************************
  641. Internal helper routines support
  642. *****************************************************************************}
  643. {$i dynarrh.inc}
  644. {$i compproc.inc}
  645. {*****************************************************************************
  646. FPDoc phony declarations.
  647. *****************************************************************************}
  648. {$ifdef fpdocsystem}
  649. {$i system.fpd}
  650. {$endif}
  651. {
  652. $Log$
  653. Revision 1.111 2004-12-05 14:36:37 hajny
  654. + GetProcessID added
  655. Revision 1.110 2004/11/26 22:26:30 peter
  656. * internconst for ptr()
  657. Revision 1.109 2004/11/22 22:48:10 michael
  658. + Added phony documentation declarations
  659. Revision 1.108 2004/11/17 22:19:04 peter
  660. internconst, internproc and some external declarations moved to interface
  661. Revision 1.107 2004/11/09 23:10:22 peter
  662. * use helper call to retrieve address of input/output to reduce
  663. code that is generated in the main program for loading the
  664. threadvar
  665. Revision 1.106 2004/11/04 09:32:31 peter
  666. ErrOutput added
  667. Revision 1.105 2004/10/30 20:49:10 marco
  668. * arraytostring added
  669. Revision 1.104 2004/10/14 17:39:33 florian
  670. + added system.align
  671. + threadvars are now aligned
  672. Revision 1.103 2004/10/09 21:00:46 jonas
  673. + cgenmath with libc math functions. Faster than the routines in genmath
  674. and also have full double support (exp() only has support for values in
  675. the single range in genmath, for example). Used in FPC_USE_LIBC is
  676. defined
  677. * several fixes to allow compilation with -dHASINLINE, but internalerrors
  678. because of missing support for inlining assembler code
  679. Revision 1.102 2004/09/22 05:56:11 hajny
  680. * compilation fix
  681. Revision 1.101 2004/09/21 23:43:26 hajny
  682. * SetTextLineEnding implemented, FileRec.Name position alignment for CPU64
  683. Revision 1.100 2004/09/21 15:04:22 peter
  684. * AnsiChar is equivalent of Char, use only type renamings
  685. Revision 1.99 2004/08/29 10:23:12 peter
  686. no message
  687. Revision 1.98 2004/07/18 20:21:44 florian
  688. + several unicode (to/from utf-8 conversion) stuff added
  689. * some longint -> SizeInt changes
  690. Revision 1.97 2004/07/07 15:15:40 daniel
  691. * Add inline directive to sysresetfpu
  692. Revision 1.96 2004/07/03 21:50:31 daniel
  693. * Modified bootstrap code so separate prt0.as/prt0_10.as files are no
  694. longer necessary
  695. Revision 1.95 2004/06/11 19:21:53 florian
  696. * fixed wrong commit
  697. Revision 1.94 2004/06/11 13:45:33 florian
  698. * fixed arm system unit compilation
  699. Revision 1.93 2004/05/30 16:51:38 peter
  700. * sparc need software shl shr
  701. Revision 1.92 2004/05/05 21:26:34 florian
  702. * some m68k and amiga related stuff fixed
  703. Revision 1.91 2004/05/01 23:55:18 peter
  704. * replace strlenint with sizeint
  705. Revision 1.90 2004/05/01 20:52:50 peter
  706. * ValSInt fixed for 64 bit
  707. Revision 1.89 2004/04/29 18:59:43 peter
  708. * str() helpers now also use valint/valuint
  709. * int64/qword helpers disabled for cpu64
  710. Revision 1.88 2004/04/22 17:10:38 peter
  711. * random(int64) added
  712. Revision 1.87 2004/03/23 22:35:45 peter
  713. * new compiler has smallint,longint,word internal defined
  714. Revision 1.86 2004/02/20 22:15:16 florian
  715. + x86_64 dependend sysutils part added
  716. * some 64 bit adaptions
  717. Revision 1.85 2004/02/20 11:01:20 daniel
  718. * Applied
  719. Revision 1.84 2004/02/02 20:39:27 florian
  720. + added prefetch(const mem)
  721. Revision 1.83 2004/01/26 11:48:24 florian
  722. * compilation on arm fixed
  723. Revision 1.82 2004/01/20 23:13:53 hajny
  724. * ExecuteProcess fixes, ProcessID and ThreadID added
  725. Revision 1.81 2003/12/29 19:24:12 florian
  726. + introduced PtrInt and PtrUInt
  727. * made strscan 64 bit safe
  728. Revision 1.80 2003/11/29 17:27:05 michael
  729. + Added overloaded version of SetWideStringManager without old parameter
  730. Revision 1.79 2003/11/28 20:36:13 michael
  731. + Added WideStringManager
  732. Revision 1.78 2003/11/15 19:01:27 florian
  733. * fixed rtl to work with the integrated fpc ppc assembler reader
  734. Revision 1.77 2003/11/03 09:42:28 marco
  735. * Peter's Cardinal<->Longint fixes patch
  736. Revision 1.76 2003/10/17 20:52:12 olle
  737. * Changed m68k to cpum68k, i386 to cpui386
  738. Revision 1.75 2003/10/16 15:43:13 peter
  739. * THandle is platform dependent
  740. Revision 1.74 2003/10/08 16:24:47 florian
  741. * fixed some variant issues
  742. * improved type declarations
  743. Revision 1.72 2003/09/04 16:07:31 florian
  744. * fixed qword_to_double conversion on powerpc
  745. Revision 1.71 2003/09/03 14:09:37 florian
  746. * arm fixes to the common rtl code
  747. * some generic math code fixed
  748. * ...
  749. Revision 1.70 2003/09/01 20:47:23 peter
  750. * pcomp added for sparc
  751. Revision 1.69 2003/05/01 08:05:23 florian
  752. * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C)
  753. Revision 1.68 2003/04/30 16:36:39 florian
  754. + support for generic pchar routines added
  755. + some basic rtl stuff for x86-64 added
  756. Revision 1.67 2003/04/25 21:09:44 peter
  757. * remove dos lf
  758. Revision 1.66 2003/04/23 22:46:41 florian
  759. + powerpc defines now pcomp as well
  760. Revision 1.65 2003/04/01 15:36:31 peter
  761. * make HResult unique type
  762. Revision 1.64 2003/03/17 14:30:11 peter
  763. * changed address parameter/return values to pointer instead
  764. of longint
  765. Revision 1.63 2003/01/13 14:37:11 florian
  766. * cpu defines fixed
  767. * ... = type ...; stuff reactived, should work now with 1.1
  768. Revision 1.62 2002/12/21 17:20:27 florian
  769. + some types for D6 compatibility added
  770. Revision 1.61 2002/12/15 22:33:12 peter
  771. * SetString(WideString,[PChar|PWideChar],Len) added
  772. Revision 1.60 2002/11/16 20:12:22 florian
  773. + sparc types added
  774. + UTF*/UCS* types added
  775. Revision 1.59 2002/10/14 19:39:17 peter
  776. * threads unit added for thread support
  777. Revision 1.58 2002/10/06 13:56:47 carl
  778. - remove stack checking for every target in system unit
  779. Revision 1.57 2002/10/02 18:21:51 peter
  780. * Copy() changed to internal function calling compilerprocs
  781. * FPC_SHORTSTR_COPY renamed to FPC_SHORTSTR_ASSIGN because of the
  782. new copy functions
  783. Revision 1.56 2002/09/28 21:18:02 florian
  784. * map comp to int64 for the powerpc
  785. Revision 1.55 2002/09/26 21:50:37 florian
  786. + some WideString<->AnsiString conversion functions added
  787. Revision 1.54 2002/09/07 21:20:50 carl
  788. * cardinal -> longword
  789. - remove FPUInt64 variable
  790. Revision 1.53 2002/09/07 15:07:46 peter
  791. * old logs removed and tabs fixed
  792. Revision 1.52 2002/08/19 19:34:02 peter
  793. * SYSTEMINLINE define that will add inline directives for small
  794. functions and wrappers. This will be defined automaticly when
  795. the compiler defines the HASINLINE directive
  796. Revision 1.51 2002/08/06 20:53:38 michael
  797. + Added support for octal strings (using &)
  798. Revision 1.50 2002/07/26 22:46:06 florian
  799. * interface of system unit for Linux/PowerPC compiles
  800. Revision 1.49 2002/07/26 21:29:03 florian
  801. + powerpc type support
  802. Revision 1.48 2002/07/04 20:40:09 florian
  803. + some x86-64 support added
  804. Revision 1.47 2002/07/01 16:29:05 peter
  805. * sLineBreak changed to normal constant like Kylix
  806. Revision 1.46 2002/06/02 10:49:30 marco
  807. * Renamefest supports_double for FreeBSD too
  808. Revision 1.45 2002/04/21 15:51:51 carl
  809. * StackError is now a typed constant
  810. + $S can be used under unix
  811. Revision 1.44 2002/04/12 17:35:24 carl
  812. - removed unused variable
  813. Revision 1.43 2002/01/25 17:41:05 peter
  814. * moved array types to objpas unit
  815. Revision 1.42 2002/01/25 17:39:35 peter
  816. * array types added
  817. Revision 1.41 2002/01/24 18:27:06 peter
  818. * lowercase() overloaded
  819. Revision 1.40 2002/01/24 12:33:53 jonas
  820. * adapted ranges of native types to int64 (e.g. high cardinal is no
  821. longer longint($ffffffff), but just $fffffff in psystem)
  822. * small additional fix in 64bit rangecheck code generation for 32 bit
  823. processors
  824. * adaption of ranges required the matching talgorithm used for selecting
  825. which overloaded procedure to call to be adapted. It should now always
  826. select the closest match for ordinal parameters.
  827. + inttostr(qword) in sysstr.inc/sysstrh.inc
  828. + abs(int64), sqr(int64), sqr(qword) in systemh.inc/generic.inc (previous
  829. fixes were required to be able to add them)
  830. * is_in_limit() moved from ncal to types unit, should always be used
  831. instead of direct comparisons of low/high values of orddefs because
  832. qword is a special case
  833. }