compproc.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 declarations of internal compiler helper
  6. routines. That means you can *NOT* call these directly, as they may
  7. be changed or even removed at any time. The only reason they are
  8. included in the interface of the system unit, is so that the
  9. compiler doesn't need special code to access their parameter
  10. list information etc.
  11. Note that due to the "compilerproc" directive, it isn't even possible
  12. to use these routines in your programs.
  13. See the File COPYING.FPC, included in this distribution,
  14. for details about the copyright.
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. **********************************************************************}
  19. {$ifdef hascompilerproc}
  20. procedure fpc_Shortstr_SetLength(var s:shortstring;len:StrLenInt); compilerproc;
  21. procedure fpc_shortstr_copy(len:longint;sstr,dstr:pointer); compilerproc;
  22. procedure fpc_shortstr_concat(s1,s2:pointer); compilerproc;
  23. function fpc_shortstr_compare(dstr,sstr:pointer) : longint; compilerproc;
  24. function fpc_chararray_to_shortstr(p:pchar; l : longint):shortstring; compilerproc;
  25. procedure fpc_str_to_chararray(strtyp, arraysize: longint; src,dest: pchar);compilerproc;
  26. function fpc_dynarray_length(p : pointer) : tdynarrayindex; compilerproc;
  27. function fpc_dynarray_high(p : pointer) : tdynarrayindex; compilerproc;
  28. procedure fpc_dynarray_decr_ref(var p : pointer;ti : pointer); compilerproc;
  29. procedure fpc_dynarray_incr_ref(var p : pointer); compilerproc;
  30. procedure fpc_dynarray_setlength(var p : pointer;pti : pointer;
  31. dimcount : dword;dims : pdynarrayindex); compilerproc;
  32. function fpc_dynarray_copy(var p : pointer;ti : pointer;
  33. dimcount : dword;dims : pdynarrayindex) : pointer; compilerproc;
  34. procedure fpc_ShortStr_Float(d : ValReal;len,fr,rt : longint;var s : shortstring); compilerproc;
  35. procedure fpc_ShortStr_Longint(v : longint;len : longint;var s : shortstring); compilerproc;
  36. procedure fpc_shortstr_cardinal(v : cardinal;len : longint;var s : shortstring); compilerproc;
  37. Function fpc_Val_SInt_ShortStr(DestSize: longint; Const S: ShortString; var Code: ValSInt): ValSInt; compilerproc;
  38. Function fpc_Val_UInt_Shortstr(Const S: ShortString; var Code: ValSInt): ValUInt; compilerproc;
  39. Function fpc_Val_Real_ShortStr(const s : shortstring; var code : ValSInt): ValReal; compilerproc;
  40. Procedure fpc_AnsiStr_Decr_Ref (Var S : Pointer); compilerproc;
  41. Procedure fpc_AnsiStr_Incr_Ref (Var S : Pointer); compilerproc;
  42. Procedure fpc_AnsiStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
  43. Procedure fpc_AnsiStr_Concat (S1,S2 : Pointer;var S3 : Pointer); compilerproc;
  44. {$ifdef EXTRAANSISHORT}
  45. Procedure fpc_AnsiStr_ShortStr_Concat (Var S1: AnsiString; Var S2 : ShortString); compilerproc;
  46. {$endif EXTRAANSISHORT}
  47. Procedure fpc_AnsiStr_To_ShortStr (Var S1 : ShortString;S2 : Pointer); compilerproc;
  48. Procedure fpc_ShortStr_To_AnsiStr (Var S1 : Pointer; Const S2 : ShortString); compilerproc;
  49. Procedure fpc_Char_To_AnsiStr(var S1 : Pointer; c : Char); compilerproc;
  50. Procedure fpc_PChar_To_AnsiStr(var a : ansistring;p : pchar); compilerproc;
  51. Procedure fpc_CharArray_To_AnsiStr(var a : ansistring;p : pchar;l:longint); compilerproc;
  52. Function fpc_AnsiStr_Compare(S1,S2 : Pointer): Longint; compilerproc;
  53. Procedure fpc_AnsiStr_CheckZero(p : pointer); compilerproc;
  54. Procedure fpc_AnsiStr_CheckRange(len,index : longint); compilerproc;
  55. {$ifdef EXTRAANSISHORT}
  56. Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString): Longint; compilerproc;
  57. {$endif EXTRAANSISHORT}
  58. Procedure fpc_ansistr_Unique(Var S : AnsiString); compilerproc;
  59. Procedure fpc_WideStr_Decr_Ref (Var S : Pointer); compilerproc;
  60. Procedure fpc_WideStr_Incr_Ref (Var S : Pointer); compilerproc;
  61. Procedure fpc_WideStr_To_ShortStr (Var S1 : ShortString;S2 : Pointer); compilerproc;
  62. Procedure fpc_ShortStr_To_WideStr (Var S1 : Pointer; Const S2 : ShortString); compilerproc;
  63. Procedure fpc_WideStr_To_AnsiStr (Var S1 : Pointer;S2 : Pointer); compilerproc;
  64. Procedure fpc_AnsiStr_To_WideStr (Var S1 : Pointer; Const S2 : Pointer); compilerproc;
  65. Procedure fpc_WideStr_Assign (Var S1 : Pointer;S2 : Pointer); compilerproc;
  66. Procedure fpc_WideStr_Concat (S1,S2 : Pointer;var S3 : Pointer); compilerproc;
  67. Procedure fpc_Char_To_WideStr(var S1 : Pointer; c : Char); compilerproc;
  68. Procedure fpc_PChar_To_WideStr(var a : widestring;p : pchar); compilerproc;
  69. Procedure fpc_CharArray_To_WideStr(var a : widestring;p : pchar;l:longint); compilerproc;
  70. Function fpc_WideStr_Compare(S1,S2 : Pointer): Longint; compilerproc;
  71. Procedure fpc_WideStr_CheckZero(p : pointer); compilerproc;
  72. Procedure fpc_WideStr_CheckRange(len,index : longint); compilerproc;
  73. Procedure fpc_WideStr_SetLength (Var S : WideString; l : Longint); compilerproc;
  74. Procedure fpc_widestr_Unique(Var S : WideString); compilerproc;
  75. Function fpc_Val_Real_AnsiStr(Const S : AnsiString; Var Code : ValSInt): ValReal; compilerproc;
  76. Function fpc_Val_UInt_AnsiStr (Const S : AnsiString; Var Code : ValSInt): ValUInt; compilerproc;
  77. Function fpc_Val_SInt_AnsiStr (DestSize: longint; Const S : AnsiString; Var Code : ValSInt): ValSInt; compilerproc;
  78. Function fpc_Val_UInt64_AnsiStr (Const S : AnsiString; Var Code : ValSInt): qword;compilerproc;
  79. Function fpc_Val_SInt64_AnsiStr (Const S : AnsiString; Var Code : ValSInt): Int64; compilerproc;
  80. procedure fpc_AnsiStr_Float(d : ValReal;len,fr,rt : longint;var s : ansistring); compilerproc;
  81. Procedure fpc_AnsiStr_UInt(C : Cardinal;Len : Longint; Var S : AnsiString); compilerproc;
  82. Procedure fpc_AnsiStr_SInt(L : Longint; Len : Longint; Var S : AnsiString); compilerproc;
  83. Function fpc_Val_Real_WideStr(Const S : WideString; Var Code : ValSInt): ValReal; compilerproc;
  84. Function fpc_Val_UInt_WideStr (Const S : WideString; Var Code : ValSInt): ValUInt; compilerproc;
  85. Function fpc_Val_SInt_WideStr (DestSize: longint; Const S : WideString; Var Code : ValSInt): ValSInt; compilerproc;
  86. Function fpc_Val_UInt64_WideStr (Const S : WideString; Var Code : ValSInt): qword; compilerproc;
  87. Function fpc_Val_SInt64_WideStr (Const S : WideString; Var Code : ValSInt): Int64; compilerproc;
  88. procedure fpc_WideStr_Float(d : ValReal;len,fr,rt : longint;var s : WideString); compilerproc;
  89. Procedure fpc_WideStr_Cardinal(C : Cardinal;Len : Longint; Var S : WideString); compilerproc;
  90. Procedure fpc_WideStr_Longint(L : Longint; Len : Longint; Var S : WideString); compilerproc;
  91. function fpc_do_is(aclass : tclass;aobject : tobject) : boolean; compilerproc;
  92. procedure fpc_do_as(aclass : tclass;aobject : tobject); compilerproc;
  93. procedure fpc_intf_decr_ref(var i: pointer); compilerproc;
  94. procedure fpc_intf_incr_ref(const i: pointer); compilerproc;
  95. procedure fpc_intf_assign(var D: pointer; const S: pointer); compilerproc;
  96. procedure fpc_intf_as(var D: pointer; const S: pointer; const iid: TGUID); compilerproc;
  97. Function fpc_PushExceptAddr (Ft: Longint;_buf,_newaddr : pointer): PJmp_buf ; compilerproc;
  98. Procedure fpc_PushExceptObj (Obj : TObject; AnAddr,AFrame : Pointer); compilerproc;
  99. Function fpc_Raiseexception (Obj : TObject; AnAddr,AFrame : Pointer) : TObject; compilerproc;
  100. Procedure fpc_PopAddrStack; compilerproc;
  101. function fpc_PopObjectStack : TObject; compilerproc;
  102. function fpc_PopSecondObjectStack : TObject; compilerproc;
  103. Procedure fpc_ReRaise; compilerproc;
  104. Function fpc_Catches(Objtype : TClass) : TObject; compilerproc;
  105. Procedure fpc_DestroyException(o : TObject); compilerproc;
  106. procedure fpc_help_constructor; compilerproc;
  107. procedure fpc_help_fail; compilerproc;
  108. procedure fpc_help_destructor; compilerproc;
  109. procedure fpc_new_class; compilerproc;
  110. procedure fpc_dispose_class; compilerproc;
  111. procedure fpc_help_fail_class; compilerproc;
  112. procedure fpc_check_object(obj : pointer); compilerproc;
  113. procedure fpc_check_object_ext; compilerproc;
  114. Procedure fpc_Initialize (Data,TypeInfo : pointer); compilerproc;
  115. Procedure fpc_Finalize (Data,TypeInfo: Pointer); compilerproc;
  116. Procedure fpc_Addref (Data,TypeInfo : Pointer); compilerproc;
  117. Procedure fpc_DecRef (Data,TypeInfo : Pointer); compilerproc;
  118. procedure fpc_FinalizeArray(data,typeinfo : pointer;count,size : longint); compilerproc;
  119. procedure fpc_set_load_small(p : pointer;l:longint); compilerproc;
  120. procedure fpc_set_create_element(p : pointer;b : byte); compilerproc;
  121. procedure fpc_set_set_byte(p : pointer;b : byte); compilerproc;
  122. procedure fpc_set_unset_byte(p : pointer;b : byte); compilerproc;
  123. procedure fpc_set_set_range(p : pointer;l,h : byte); compilerproc;
  124. procedure fpc_set_in_byte(p : pointer;b : byte); compilerproc;
  125. procedure fpc_set_add_sets(set1,set2,dest : pointer); compilerproc;
  126. procedure fpc_set_mul_sets(set1,set2,dest:pointer); compilerproc;
  127. procedure fpc_set_sub_sets(set1,set2,dest:pointer); compilerproc;
  128. procedure fpc_set_symdif_sets(set1,set2,dest:pointer); compilerproc;
  129. procedure fpc_set_comp_sets(set1,set2 : pointer); compilerproc;
  130. procedure fpc_set_contains_sets(set1,set2 : pointer); compilerproc;
  131. {$ifdef LARGESETS}
  132. procedure fpc_largeset_set_word(p : pointer;b : word); compilerproc;
  133. procedure fpc_largeset_in_word(p : pointer;b : word); compilerproc;
  134. procedure fpc_largeset_add_sets(set1,set2,dest : pointer;size : longint); compilerproc;
  135. procedure fpc_largeset_sets(set1,set2,dest : pointer;size : longint); compilerproc;
  136. procedure fpc_largeset_sub_sets(set1,set2,dest : pointer;size : longint); compilerproc;
  137. procedure fpc_largeset_symdif_sets(set1,set2,dest : pointer;size : longint); compilerproc;
  138. procedure fpc_largeset_comp_sets(set1,set2 : pointer;size : longint); compilerproc;
  139. procedure fpc_largeset_contains_sets(set1,set2 : pointer; size: longint); compilerproc;
  140. {$endif LARGESETS}
  141. procedure fpc_rangeerror; compilerproc;
  142. procedure fpc_overflow; compilerproc;
  143. procedure fpc_iocheck(addr : longint); compilerproc;
  144. procedure fpc_InitializeUnits; compilerproc;
  145. // not generated by compiler, called directly in system unit
  146. // procedure fpc_FinalizeUnits; compilerproc;
  147. {
  148. Procedure fpc_do_exit; compilerproc;
  149. Procedure fpc_lib_exit; compilerproc;
  150. Procedure fpc_HandleErrorAddrFrame (Errno : longint;addr,frame : longint); compilerproc;
  151. Procedure fpc_HandleError (Errno : longint); compilerproc;
  152. }
  153. procedure fpc_AbstractErrorIntern;compilerproc;
  154. procedure fpc_assert(Const Msg,FName:Shortstring;LineNo,ErrorAddr:Longint); compilerproc;
  155. {$endif hascompilerproc}
  156. {
  157. $Log$
  158. Revision 1.1 2001-08-01 15:00:10 jonas
  159. + "compproc" helpers
  160. * renamed several helpers so that their name is the same as their
  161. "public alias", which should facilitate the conversion of processor
  162. specific code in the code generator to processor independent code
  163. * some small fixes to the val_ansistring and val_widestring helpers
  164. (always immediately exit if the source string is longer than 255
  165. chars)
  166. * fixed fpc_dynarray_high and fpc_dynarray_length if the dynarray is
  167. still nil (used to crash, now return resp -1 and 0)
  168. }