Browse Source

internconst, internproc and some external declarations moved to interface

peter 20 years ago
parent
commit
14eb8f59b4
11 changed files with 307 additions and 225 deletions
  1. 7 4
      rtl/i386/i386.inc
  2. 22 15
      rtl/i386/math.inc
  3. 6 5
      rtl/inc/astrings.inc
  4. 16 19
      rtl/inc/generic.inc
  5. 85 82
      rtl/inc/innr.inc
  6. 56 7
      rtl/inc/mathh.inc
  7. 5 4
      rtl/inc/sstrings.inc
  8. 42 43
      rtl/inc/system.inc
  9. 55 38
      rtl/inc/systemh.inc
  10. 8 3
      rtl/inc/text.inc
  11. 5 5
      rtl/inc/wstrings.inc

+ 7 - 4
rtl/i386/i386.inc

@@ -1281,7 +1281,7 @@ end ['EAX'];
 ****************************************************************************}
 ****************************************************************************}
 
 
 {$define FPC_SYSTEM_HAS_ABS_LONGINT}
 {$define FPC_SYSTEM_HAS_ABS_LONGINT}
-function abs(l:longint):longint; assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_abs];
+function abs(l:longint):longint; assembler;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_abs];{$endif}
 asm
 asm
 {$ifndef REGCALL}
 {$ifndef REGCALL}
         movl    l,%eax
         movl    l,%eax
@@ -1293,7 +1293,7 @@ end ['EAX','EDX'];
 
 
 
 
 {$define FPC_SYSTEM_HAS_ODD_LONGINT}
 {$define FPC_SYSTEM_HAS_ODD_LONGINT}
-function odd(l:longint):boolean;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_odd];
+function odd(l:longint):boolean;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}
 asm
 asm
 {$ifdef SYSTEMINLINE}
 {$ifdef SYSTEMINLINE}
        movl     l,%eax
        movl     l,%eax
@@ -1308,7 +1308,7 @@ end ['EAX'];
 
 
 
 
 {$define FPC_SYSTEM_HAS_SQR_LONGINT}
 {$define FPC_SYSTEM_HAS_SQR_LONGINT}
-function sqr(l:longint):longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_sqr];
+function sqr(l:longint):longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}
 asm
 asm
 {$ifdef SYSTEMINLINE}
 {$ifdef SYSTEMINLINE}
        movl     l,%eax
        movl     l,%eax
@@ -1510,7 +1510,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.65  2004-11-01 12:43:29  peter
+  Revision 1.66  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.65  2004/11/01 12:43:29  peter
     * shortstr compare with empty string fixed
     * shortstr compare with empty string fixed
     * removed special i386 code
     * removed special i386 code
 
 

+ 22 - 15
rtl/i386/math.inc

@@ -39,25 +39,27 @@
                        EXTENDED data type routines
                        EXTENDED data type routines
  ****************************************************************************}
  ****************************************************************************}
 
 
+{$ifndef INTERNCONSTINTF}
     {$define FPC_SYSTEM_HAS_PI}
     {$define FPC_SYSTEM_HAS_PI}
-    function pi : extended;[internproc:in_pi];
+    function pi : extended;[internproc:fpc_in_pi];
     {$define FPC_SYSTEM_HAS_ABS}
     {$define FPC_SYSTEM_HAS_ABS}
-    function abs(d : extended) : extended;[internproc:in_abs_extended];
+    function abs(d : extended) : extended;[internproc:fpc_in_abs_extended];
     {$define FPC_SYSTEM_HAS_SQR}
     {$define FPC_SYSTEM_HAS_SQR}
-    function sqr(d : extended) : extended;[internproc:in_sqr_extended];
+    function sqr(d : extended) : extended;[internproc:fpc_in_sqr_extended];
     {$define FPC_SYSTEM_HAS_SQRT}
     {$define FPC_SYSTEM_HAS_SQRT}
-    function sqrt(d : extended) : extended;[internproc:in_sqrt_extended];
+    function sqrt(d : extended) : extended;[internproc:fpc_in_sqrt_extended];
     {$define FPC_SYSTEM_HAS_ARCTAN}
     {$define FPC_SYSTEM_HAS_ARCTAN}
-    function arctan(d : extended) : extended;[internproc:in_arctan_extended];
+    function arctan(d : extended) : extended;[internproc:fpc_in_arctan_extended];
     {$define FPC_SYSTEM_HAS_LN}
     {$define FPC_SYSTEM_HAS_LN}
-    function ln(d : extended) : extended;[internproc:in_ln_extended];
+    function ln(d : extended) : extended;[internproc:fpc_in_ln_extended];
     {$define FPC_SYSTEM_HAS_SIN}
     {$define FPC_SYSTEM_HAS_SIN}
-    function sin(d : extended) : extended;[internproc:in_sin_extended];
+    function sin(d : extended) : extended;[internproc:fpc_in_sin_extended];
     {$define FPC_SYSTEM_HAS_COS}
     {$define FPC_SYSTEM_HAS_COS}
-    function cos(d : extended) : extended;[internproc:in_cos_extended];
+    function cos(d : extended) : extended;[internproc:fpc_in_cos_extended];
+{$endif}
 
 
     {$define FPC_SYSTEM_HAS_EXP}
     {$define FPC_SYSTEM_HAS_EXP}
-    function exp(d : extended) : extended;assembler;[internconst:in_const_exp];
+    function exp(d : extended) : extended;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_exp];{$endif}
        asm
        asm
             // comes from DJ GPP
             // comes from DJ GPP
             fldt        d
             fldt        d
@@ -91,7 +93,7 @@
 
 
 
 
     {$define FPC_SYSTEM_HAS_FRAC}
     {$define FPC_SYSTEM_HAS_FRAC}
-    function frac(d : extended) : extended;assembler;[internconst:in_const_frac];
+    function frac(d : extended) : extended;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_frac];{$endif}
       asm
       asm
             subl $16,%esp
             subl $16,%esp
             fnstcw -4(%ebp)
             fnstcw -4(%ebp)
@@ -112,7 +114,7 @@
 
 
 
 
     {$define FPC_SYSTEM_HAS_INT}
     {$define FPC_SYSTEM_HAS_INT}
-    function int(d : extended) : extended;assembler;[internconst:in_const_int];
+    function int(d : extended) : extended;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_int];{$endif}
       asm
       asm
             subl $16,%esp
             subl $16,%esp
             fnstcw -4(%ebp)
             fnstcw -4(%ebp)
@@ -131,7 +133,7 @@
 
 
 
 
     {$define FPC_SYSTEM_HAS_TRUNC}
     {$define FPC_SYSTEM_HAS_TRUNC}
-    function trunc(d : extended) : int64;assembler;[internconst:in_const_trunc];
+    function trunc(d : extended) : int64;assembler;{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_trunc];{$endif}
       var
       var
         oldcw,
         oldcw,
         newcw : word;
         newcw : word;
@@ -155,11 +157,13 @@
 
 
     {$define FPC_SYSTEM_HAS_ROUND}
     {$define FPC_SYSTEM_HAS_ROUND}
 {$ifdef hascompilerproc}
 {$ifdef hascompilerproc}
-    function round(d : extended) : int64;[internconst:in_const_round, external name 'FPC_ROUND'];
+  {$ifndef internconstintf}
+    function round(d : extended) : int64;[internconst:fpc_in_const_round, external name 'FPC_ROUND'];
+  {$endif internconstintf}
 
 
     function fpc_round(d : extended) : int64;assembler;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
     function fpc_round(d : extended) : int64;assembler;[public, alias:'FPC_ROUND'];{$ifdef hascompilerproc}compilerproc;{$endif hascompilerproc}
 {$else}
 {$else}
-    function round(d : extended) : int64;assembler;[internconst:in_const_round];
+    function round(d : extended) : int64;assembler;[internconst:fpc_in_const_round];
 {$endif hascompilerproc}
 {$endif hascompilerproc}
       var
       var
         oldcw,
         oldcw,
@@ -210,7 +214,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2004-07-09 23:06:11  peter
+  Revision 1.20  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.19  2004/07/09 23:06:11  peter
     * add fclex for fpu exceptions to round/trunc
     * add fclex for fpu exceptions to round/trunc
 
 
   Revision 1.18  2003/11/29 16:40:12  jonas
   Revision 1.18  2003/11/29 16:40:12  jonas

+ 6 - 5
rtl/inc/astrings.inc

@@ -502,11 +502,9 @@ end;
 
 
 
 
 {$ifdef HASCOMPILERPROC}
 {$ifdef HASCOMPILERPROC}
-{ overloaded version of UniqueString for interface }
-Procedure UniqueString(Var S : AnsiString); [external name 'FPC_ANSISTR_UNIQUE'];
 Function fpc_ansistr_Unique(Var S : Pointer): Pointer; [Public,Alias : 'FPC_ANSISTR_UNIQUE']; {$ifdef hascompilerproc} compilerproc; {$endif}
 Function fpc_ansistr_Unique(Var S : Pointer): Pointer; [Public,Alias : 'FPC_ANSISTR_UNIQUE']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {$else}
 {$else}
-Procedure UniqueString(Var S : AnsiString); [Public,Alias : 'FPC_ANSISTR_UNIQUE'];
+Procedure fpc_ansistr_Unique(Var S : AnsiString); [Public,Alias : 'FPC_ANSISTR_UNIQUE'];
 {$endif}
 {$endif}
 {
 {
   Make sure reference count of S is 1,
   Make sure reference count of S is 1,
@@ -690,7 +688,7 @@ begin
   else
   else
     begin
     begin
        SS := S;
        SS := S;
-       fpc_Val_SInt_AnsiStr := fpc_Val_SInt_ShortStr(DestSize,SS,Code);
+       fpc_Val_SInt_AnsiStr := int_Val_SInt_ShortStr(DestSize,SS,Code);
     end;
     end;
 end;
 end;
 
 
@@ -869,7 +867,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.49  2004-10-31 16:21:30  peter
+  Revision 1.50  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.49  2004/10/31 16:21:30  peter
     * fix shortstr_to_ansistring for 1.0.x
     * fix shortstr_to_ansistring for 1.0.x
 
 
   Revision 1.48  2004/10/24 20:01:41  peter
   Revision 1.48  2004/10/24 20:01:41  peter

+ 16 - 19
rtl/inc/generic.inc

@@ -649,14 +649,6 @@ end;
 
 
 {$endif ndef FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
 {$endif ndef FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
 
 
-{ also add a strpas alias for internal use in the system unit (JM) }
-function strpas(p:pchar):shortstring; [external name 'FPC_PCHAR_TO_SHORTSTR'];
-
-{$ifndef FPC_UNIT_HAS_STRLEN}
-
-{ if strlen is not yet defined, we need a forward declaration here }
-function strlen(p:pchar):longint; [external name 'FPC_PCHAR_LENGTH'];
-{$endif FPC_UNIT_HAS_STRLEN}
 
 
 {$ifndef FPC_SYSTEM_HAS_FPC_CHARARRAY_TO_SHORTSTR}
 {$ifndef FPC_SYSTEM_HAS_FPC_CHARARRAY_TO_SHORTSTR}
 
 
@@ -953,7 +945,7 @@ function fpc_mod_longint(n,z : longint) : longint; [public,alias: 'FPC_MOD_LONGI
 {****************************************************************************}
 {****************************************************************************}
 
 
 {$ifndef FPC_SYSTEM_HAS_ABS_LONGINT}
 {$ifndef FPC_SYSTEM_HAS_ABS_LONGINT}
-function abs(l:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_abs];
+function abs(l:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_abs];{$endif}
 begin
 begin
    if l<0 then
    if l<0 then
      abs:=-l
      abs:=-l
@@ -965,7 +957,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_ODD_LONGINT}
 {$ifndef FPC_SYSTEM_HAS_ODD_LONGINT}
 
 
-function odd(l:longint):boolean;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_odd];
+function odd(l:longint):boolean;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}
 begin
 begin
    odd:=boolean(l and 1);
    odd:=boolean(l and 1);
 end;
 end;
@@ -974,7 +966,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_ODD_LONGWORD}
 {$ifndef FPC_SYSTEM_HAS_ODD_LONGWORD}
 
 
-function odd(l:longword):boolean;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_odd];
+function odd(l:longword):boolean;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}
 begin
 begin
    odd:=boolean(l and 1);
    odd:=boolean(l and 1);
 end;
 end;
@@ -984,7 +976,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_ODD_INT64}
 {$ifndef FPC_SYSTEM_HAS_ODD_INT64}
 
 
-function odd(l:int64):boolean;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_odd];
+function odd(l:int64):boolean;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}
 begin
 begin
    odd:=boolean(longint(l) and 1);
    odd:=boolean(longint(l) and 1);
 end;
 end;
@@ -993,7 +985,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_ODD_QWORD}
 {$ifndef FPC_SYSTEM_HAS_ODD_QWORD}
 
 
-function odd(l:qword):boolean;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_odd];
+function odd(l:qword):boolean;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}
 begin
 begin
    odd:=boolean(longint(l) and 1);
    odd:=boolean(longint(l) and 1);
 end;
 end;
@@ -1002,7 +994,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_SQR_LONGINT}
 {$ifndef FPC_SYSTEM_HAS_SQR_LONGINT}
 
 
-function sqr(l:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_sqr];
+function sqr(l:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}
 begin
 begin
    sqr:=l*l;
    sqr:=l*l;
 end;
 end;
@@ -1012,7 +1004,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_ABS_INT64}
 {$ifndef FPC_SYSTEM_HAS_ABS_INT64}
 
 
-function abs(l: Int64): Int64;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_abs];
+function abs(l: Int64): Int64;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_abs];{$endif}
 begin
 begin
   if l < 0 then
   if l < 0 then
     abs := -l
     abs := -l
@@ -1025,7 +1017,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_SQR_INT64}
 {$ifndef FPC_SYSTEM_HAS_SQR_INT64}
 
 
-function sqr(l: Int64): Int64;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_sqr];
+function sqr(l: Int64): Int64;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}
 begin
 begin
   sqr := l*l;
   sqr := l*l;
 end;
 end;
@@ -1035,7 +1027,7 @@ end;
 
 
 {$ifndef FPC_SYSTEM_HAS_SQR_QWORD}
 {$ifndef FPC_SYSTEM_HAS_SQR_QWORD}
 
 
-function sqr(l: QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_sqr];
+function sqr(l: QWord): QWord;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}
 begin
 begin
   sqr := l*l;
   sqr := l*l;
 end;
 end;
@@ -1081,7 +1073,9 @@ procedure inclocked(var l:int64);
 {$endif ndef FPC_SYSTEM_HAS_SPTR}
 {$endif ndef FPC_SYSTEM_HAS_SPTR}
 
 
 
 
-procedure prefetch(const mem);[internproc:in_prefetch_var];
+{$ifndef INTERNCONSTINTF}
+procedure prefetch(const mem);[internproc:fpc_in_prefetch_var];
+{$endif}
 
 
 
 
 function align(addr : PtrInt;alignment : PtrInt) : PtrInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 function align(addr : PtrInt;alignment : PtrInt) : PtrInt;{$ifdef SYSTEMINLINE}inline;{$endif}
@@ -1241,7 +1235,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.86  2004-11-06 13:36:42  florian
+  Revision 1.87  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.86  2004/11/06 13:36:42  florian
     * fixed software longint mod operation
     * fixed software longint mod operation
 
 
   Revision 1.85  2004/11/02 08:50:40  florian
   Revision 1.85  2004/11/02 08:50:40  florian

+ 85 - 82
rtl/inc/innr.inc

@@ -16,94 +16,94 @@
 
 
 const
 const
 { Internal functions }
 { Internal functions }
-   in_lo_word           = 1;
-   in_hi_word           = 2;
-   in_lo_long           = 3;
-   in_hi_long           = 4;
-   in_ord_x             = 5;
-   in_length_string     = 6;
-   in_chr_byte          = 7;
-   in_write_x           = 14;
-   in_writeln_x         = 15;
-   in_read_x            = 16;
-   in_readln_x          = 17;
-   in_concat_x          = 18;
-   in_assigned_x        = 19;
-   in_str_x_string      = 20;
-   in_ofs_x             = 21;
-   in_sizeof_x          = 22;
-   in_typeof_x          = 23;
-   in_val_x             = 24;
-   in_reset_x           = 25;
-   in_rewrite_x         = 26;
-   in_low_x             = 27;
-   in_high_x            = 28;
-   in_seg_x             = 29;
-   in_pred_x            = 30;
-   in_succ_x            = 31;
-   in_reset_typedfile   = 32;
-   in_rewrite_typedfile = 33;
-   in_settextbuf_file_x = 34;
-   in_inc_x             = 35;
-   in_dec_x             = 36;
-   in_include_x_y       = 37;
-   in_exclude_x_y       = 38;
-   in_break             = 39;
-   in_continue          = 40;
-   in_assert_x_y        = 41;
-   in_addr_x            = 42;
-   in_typeinfo_x        = 43;
-   in_setlength_x       = 44;
-   in_finalize_x        = 45;
-   in_new_x             = 46;
-   in_dispose_x         = 47;
-   in_exit              = 48;
-   in_copy_x            = 49;
-   in_initialize_x      = 50;
-   in_leave             = 51; {macpas}
-   in_cycle             = 52; {macpas}
+   fpc_in_lo_word           = 1;
+   fpc_in_hi_word           = 2;
+   fpc_in_lo_long           = 3;
+   fpc_in_hi_long           = 4;
+   fpc_in_ord_x             = 5;
+   fpc_in_length_string     = 6;
+   fpc_in_chr_byte          = 7;
+   fpc_in_write_x           = 14;
+   fpc_in_writeln_x         = 15;
+   fpc_in_read_x            = 16;
+   fpc_in_readln_x          = 17;
+   fpc_in_concat_x          = 18;
+   fpc_in_assigned_x        = 19;
+   fpc_in_str_x_string      = 20;
+   fpc_in_ofs_x             = 21;
+   fpc_in_sizeof_x          = 22;
+   fpc_in_typeof_x          = 23;
+   fpc_in_val_x             = 24;
+   fpc_in_reset_x           = 25;
+   fpc_in_rewrite_x         = 26;
+   fpc_in_low_x             = 27;
+   fpc_in_high_x            = 28;
+   fpc_in_seg_x             = 29;
+   fpc_in_pred_x            = 30;
+   fpc_in_succ_x            = 31;
+   fpc_in_reset_typedfile   = 32;
+   fpc_in_rewrite_typedfile = 33;
+   fpc_in_settextbuf_file_x = 34;
+   fpc_in_inc_x             = 35;
+   fpc_in_dec_x             = 36;
+   fpc_in_include_x_y       = 37;
+   fpc_in_exclude_x_y       = 38;
+   fpc_in_break             = 39;
+   fpc_in_continue          = 40;
+   fpc_in_assert_x_y        = 41;
+   fpc_in_addr_x            = 42;
+   fpc_in_typeinfo_x        = 43;
+   fpc_in_setlength_x       = 44;
+   fpc_in_finalize_x        = 45;
+   fpc_in_new_x             = 46;
+   fpc_in_dispose_x         = 47;
+   fpc_in_exit              = 48;
+   fpc_in_copy_x            = 49;
+   fpc_in_initialize_x      = 50;
+   fpc_in_leave             = 51; {macpas}
+   fpc_in_cycle             = 52; {macpas}
 
 
 { Internal constant functions }
 { Internal constant functions }
-   in_const_trunc      = 100;
-   in_const_round      = 101;
-   in_const_frac       = 102;
-   in_const_abs        = 103;
-   in_const_int        = 104;
-   in_const_sqr        = 105;
-   in_const_odd        = 106;
-   in_const_ptr        = 107;
-   in_const_swap_word  = 108;
-   in_const_swap_long  = 109;
-   in_const_pi         = 110;
-   in_const_sqrt       = 111;
-   in_const_arctan     = 112;
-   in_const_cos        = 113;
-   in_const_exp        = 114;
-   in_const_ln         = 115;
-   in_const_sin        = 116;
-   in_lo_qword         = 117;
-   in_hi_qword         = 118;
-   in_cos_extended     = 119;
-   in_pi               = 121;
-   in_abs_extended     = 122;
-   in_sqr_extended     = 123;
-   in_sqrt_extended    = 124;
-   in_arctan_extended  = 125;
-   in_ln_extended      = 126;
-   in_sin_extended     = 127;
-   in_const_swap_qword = 128;
-   in_prefetch_var      = 129;
+   fpc_in_const_trunc      = 100;
+   fpc_in_const_round      = 101;
+   fpc_in_const_frac       = 102;
+   fpc_in_const_abs        = 103;
+   fpc_in_const_int        = 104;
+   fpc_in_const_sqr        = 105;
+   fpc_in_const_odd        = 106;
+   fpc_in_const_ptr        = 107;
+   fpc_in_const_swap_word  = 108;
+   fpc_in_const_swap_long  = 109;
+   fpc_in_const_pi         = 110;
+   fpc_in_const_sqrt       = 111;
+   fpc_in_const_arctan     = 112;
+   fpc_in_const_cos        = 113;
+   fpc_in_const_exp        = 114;
+   fpc_in_const_ln         = 115;
+   fpc_in_const_sin        = 116;
+   fpc_in_lo_qword         = 117;
+   fpc_in_hi_qword         = 118;
+   fpc_in_cos_extended     = 119;
+   fpc_in_pi               = 121;
+   fpc_in_abs_extended     = 122;
+   fpc_in_sqr_extended     = 123;
+   fpc_in_sqrt_extended    = 124;
+   fpc_in_arctan_extended  = 125;
+   fpc_in_ln_extended      = 126;
+   fpc_in_sin_extended     = 127;
+   fpc_in_const_swap_qword = 128;
+   fpc_in_prefetch_var      = 129;
 
 
 { MMX functions }
 { MMX functions }
 { these contants are used by the mmx unit }
 { these contants are used by the mmx unit }
 
 
    { MMX }
    { MMX }
-   in_mmx_pcmpeqb      = 200;
-   in_mmx_pcmpeqw      = 201;
-   in_mmx_pcmpeqd      = 202;
-   in_mmx_pcmpgtb      = 203;
-   in_mmx_pcmpgtw      = 204;
-   in_mmx_pcmpgtd      = 205;
+   fpc_in_mmx_pcmpeqb      = 200;
+   fpc_in_mmx_pcmpeqw      = 201;
+   fpc_in_mmx_pcmpeqd      = 202;
+   fpc_in_mmx_pcmpgtb      = 203;
+   fpc_in_mmx_pcmpgtw      = 204;
+   fpc_in_mmx_pcmpgtd      = 205;
 
 
    { 3DNow }
    { 3DNow }
 
 
@@ -111,7 +111,10 @@ const
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2004-07-05 21:59:18  olle
+  Revision 1.8  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.7  2004/07/05 21:59:18  olle
     * updated according to compiler/compinnr.inc
     * updated according to compiler/compinnr.inc
 
 
   Revision 1.6  2004/02/02 20:39:27  florian
   Revision 1.6  2004/02/02 20:39:27  florian

+ 56 - 7
rtl/inc/mathh.inc

@@ -33,14 +33,58 @@
 
 
    { declarations of the math routines }
    { declarations of the math routines }
 
 
-{$ifndef cpui386}
-{$ifdef FPC_USE_LIBC}
-{$ifdef SYSTEMINLINE}
-{$define MATHINLINE}
-{$endif}
+{$ifdef cpui386}
+  {$define INTERNMATH}
 {$endif}
 {$endif}
+
+{$ifndef INTERNMATH}
+  {$ifdef FPC_USE_LIBC}
+    {$ifdef SYSTEMINLINE}
+      {$define MATHINLINE}
+    {$endif}
+  {$endif}
 {$endif}
 {$endif}
 
 
+{$ifdef internconstintf}
+  {$ifdef INTERNMATH}
+    {$define FPC_SYSTEM_HAS_PI}
+    function pi : extended;[internproc:fpc_in_pi];
+    {$define FPC_SYSTEM_HAS_ABS}
+    function abs(d : extended) : extended;[internproc:fpc_in_abs_extended];
+    {$define FPC_SYSTEM_HAS_SQR}
+    function sqr(d : extended) : extended;[internproc:fpc_in_sqr_extended];
+    {$define FPC_SYSTEM_HAS_SQRT}
+    function sqrt(d : extended) : extended;[internproc:fpc_in_sqrt_extended];
+    {$define FPC_SYSTEM_HAS_ARCTAN}
+    function arctan(d : extended) : extended;[internproc:fpc_in_sqr_extended];
+    {$define FPC_SYSTEM_HAS_LN}
+    function ln(d : extended) : extended;[internproc:fpc_in_ln_extended];
+    {$define FPC_SYSTEM_HAS_SIN}
+    function sin(d : extended) : extended;[internproc:fpc_in_sin_extended];
+    {$define FPC_SYSTEM_HAS_COS}
+    function cos(d : extended) : extended;[internproc:fpc_in_cos_extended];
+    function exp(d : extended) : extended;[internconst:fpc_in_const_exp];
+
+    function round(d : extended) : int64;[internconst:fpc_in_const_exp];external name 'FPC_ROUND';
+    function frac(d : extended) : extended;[internconst:fpc_in_const_frac];
+    function int(d : extended) : extended;[internconst:fpc_in_const_int];
+    function trunc(d : extended) : int64;[internconst:fpc_in_const_trunc];
+  {$else}
+    function abs(d : extended) : extended;[internconst:fpc_in_abs_extended];
+    function arctan(d : extended) : extended;[internconst:fpc_in_arctan_extended];{$ifdef MATHINLINE}inline;{$endif}
+    function cos(d : extended) : extended;[internconst:fpc_in_sqr_extended];{$ifdef MATHINLINE}inline;{$endif}
+    function exp(d : extended) : extended;[internconst:fpc_in_const_exp];{$ifdef MATHINLINE}inline;{$endif}
+    function frac(d : extended) : extended;[internconst:fpc_in_const_frac];
+    function int(d : extended) : extended;[internconst:fpc_in_const_int];{$ifdef MATHINLINE}inline;{$endif}
+    function ln(d : extended) : extended;[internconst:fpc_in_ln_extended];{$ifdef MATHINLINE}inline;{$endif}
+    function pi : extended; [internconst:fpc_in_pi];
+    function sin(d : extended) : extended;[internconst:fpc_in_sin_extended];{$ifdef MATHINLINE}inline;{$endif}
+    function sqr(d : extended) : extended;[internconst:fpc_in_sqr_extended];
+    function sqrt(d : extended) : extended;[internconst:fpc_in_sqrt_extended];{$ifdef MATHINLINE}inline;{$endif}
+    function round(d : extended) : int64;[internconst:fpc_in_const_exp];
+    function trunc(d : extended) : int64;[internconst:fpc_in_const_trunc];
+  {$endif}
+{$else}
     function abs(d : extended) : extended;
     function abs(d : extended) : extended;
     function arctan(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function arctan(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function cos(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function cos(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
@@ -49,11 +93,13 @@
     function int(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function int(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function ln(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function ln(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function pi : extended;
     function pi : extended;
-    function round(d : extended) : int64;
     function sin(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function sin(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function sqr(d : extended) : extended;
     function sqr(d : extended) : extended;
     function sqrt(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
     function sqrt(d : extended) : extended;{$ifdef MATHINLINE}inline;{$endif}
+    function round(d : extended) : int64;
     function trunc(d : extended) : int64;
     function trunc(d : extended) : int64;
+{$endif internconstintf}
+
     function power(bas,expo : extended) : extended;
     function power(bas,expo : extended) : extended;
     function power(bas,expo : int64) : int64;
     function power(bas,expo : int64) : int64;
 
 
@@ -78,7 +124,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2004-10-09 21:00:46  jonas
+  Revision 1.17  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.16  2004/10/09 21:00:46  jonas
     + cgenmath with libc math functions. Faster than the routines in genmath
     + cgenmath with libc math functions. Faster than the routines in genmath
       and also have full double support (exp() only has support for values in
       and also have full double support (exp() only has support for values in
       the single range in genmath, for example). Used in FPC_USE_LIBC is
       the single range in genmath, for example). Used in FPC_USE_LIBC is

+ 5 - 4
rtl/inc/sstrings.inc

@@ -601,11 +601,9 @@ begin
     End;
     End;
 end;
 end;
 
 
-{$ifdef hascompilerproc}
 { we need this for fpc_Val_SInt_Ansistr and fpc_Val_SInt_WideStr because }
 { we need this for fpc_Val_SInt_Ansistr and fpc_Val_SInt_WideStr because }
 { we have to pass the DestSize parameter on (JM)                         }
 { we have to pass the DestSize parameter on (JM)                         }
-Function fpc_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; var Code: ValSInt): ValSInt; [external name 'FPC_VAL_SINT_SHORTSTR'];
-{$endif hascompilerproc}
+Function int_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortString; var Code: ValSInt): ValSInt; [external name 'FPC_VAL_SINT_SHORTSTR'];
 
 
 
 
 Function fpc_Val_UInt_Shortstr(Const S: ShortString; var Code: ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_SHORTSTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
 Function fpc_Val_UInt_Shortstr(Const S: ShortString; var Code: ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_SHORTSTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
@@ -867,7 +865,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.31  2004-11-02 22:38:58  jonas
+  Revision 1.32  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.31  2004/11/02 22:38:58  jonas
     * fixed endianess bug in fpc_val_int64_shortstr() (webtbf/tw2128)
     * fixed endianess bug in fpc_val_int64_shortstr() (webtbf/tw2128)
 
 
   Revision 1.30  2004/05/01 23:55:18  peter
   Revision 1.30  2004/05/01 23:55:18  peter

+ 42 - 43
rtl/inc/system.inc

@@ -51,30 +51,30 @@ var
                      Routines which have compiler magic
                      Routines which have compiler magic
 ****************************************************************************}
 ****************************************************************************}
 
 
-{$I innr.inc}
-
-Function  lo(i : Integer) : byte;  [INTERNPROC: In_lo_Word];
-Function  lo(w : Word) : byte;     [INTERNPROC: In_lo_Word];
-Function  lo(l : Longint) : Word;  [INTERNPROC: In_lo_long];
-Function  lo(l : DWord) : Word;    [INTERNPROC: In_lo_long];
-Function  hi(i : Integer) : byte;  [INTERNPROC: In_hi_Word];
-Function  hi(w : Word) : byte;     [INTERNPROC: In_hi_Word];
-Function  hi(l : Longint) : Word;  [INTERNPROC: In_hi_long];
-Function  hi(l : DWord) : Word;    [INTERNPROC: In_hi_long];
-
-Function  lo(q : QWord) : DWord;  [INTERNPROC: In_lo_qword];
-Function  lo(i : Int64) : DWord;  [INTERNPROC: In_lo_qword];
-Function  hi(q : QWord) : DWord;  [INTERNPROC: In_hi_qword];
-Function  hi(i : Int64) : DWord;  [INTERNPROC: In_hi_qword];
-
-Function chr(b : byte) : Char;      [INTERNPROC: In_chr_byte];
+{$ifndef INTERNCONSTINTF}
+Function  lo(i : Integer) : byte;  [INTERNPROC: fpc_in_lo_Word];
+Function  lo(w : Word) : byte;     [INTERNPROC: fpc_in_lo_Word];
+Function  lo(l : Longint) : Word;  [INTERNPROC: fpc_in_lo_long];
+Function  lo(l : DWord) : Word;    [INTERNPROC: fpc_in_lo_long];
+Function  hi(i : Integer) : byte;  [INTERNPROC: fpc_in_hi_Word];
+Function  hi(w : Word) : byte;     [INTERNPROC: fpc_in_hi_Word];
+Function  hi(l : Longint) : Word;  [INTERNPROC: fpc_in_hi_long];
+Function  hi(l : DWord) : Word;    [INTERNPROC: fpc_in_hi_long];
+
+Function  lo(q : QWord) : DWord;  [INTERNPROC: fpc_in_lo_qword];
+Function  lo(i : Int64) : DWord;  [INTERNPROC: fpc_in_lo_qword];
+Function  hi(q : QWord) : DWord;  [INTERNPROC: fpc_in_hi_qword];
+Function  hi(i : Int64) : DWord;  [INTERNPROC: fpc_in_hi_qword];
+
+Function chr(b : byte) : Char;      [INTERNPROC: fpc_in_chr_byte];
 {$ifndef INTERNLENGTH}
 {$ifndef INTERNLENGTH}
-Function Length(s : string) : byte; [INTERNPROC: In_Length_string];
-Function Length(c : char) : byte;   [INTERNPROC: In_Length_string];
+Function Length(s : string) : byte; [INTERNPROC: fpc_in_Length_string];
+Function Length(c : char) : byte;   [INTERNPROC: fpc_in_Length_string];
 {$endif INTERNLENGTH}
 {$endif INTERNLENGTH}
 
 
-Procedure Reset(var f : TypedFile);   [INTERNPROC: In_Reset_TypedFile];
-Procedure Rewrite(var f : TypedFile); [INTERNPROC: In_Rewrite_TypedFile];
+Procedure Reset(var f : TypedFile);   [INTERNPROC: fpc_in_Reset_TypedFile];
+Procedure Rewrite(var f : TypedFile); [INTERNPROC: fpc_in_Rewrite_TypedFile];
+{$endif INTERNCONSTINTF}
 
 
 
 
 {****************************************************************************
 {****************************************************************************
@@ -190,45 +190,45 @@ begin
    Lo := b and $0f
    Lo := b and $0f
 end;
 end;
 
 
-Function swap (X : Word) : Word;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_swap_word];
+Function swap (X : Word) : Word;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_swap_word];{$endif}
 Begin
 Begin
   swap:=(X and $ff) shl 8 + (X shr 8)
   swap:=(X and $ff) shl 8 + (X shr 8)
 End;
 End;
 
 
-Function Swap (X : Integer) : Integer;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_swap_word];
+Function Swap (X : Integer) : Integer;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_swap_word];{$endif}
 Begin
 Begin
   swap:=(X and $ff) shl 8 + (X shr 8)
   swap:=(X and $ff) shl 8 + (X shr 8)
 End;
 End;
 
 
-Function swap (X : Longint) : Longint;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_swap_long];
+Function swap (X : Longint) : Longint;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_swap_long];{$endif}
 Begin
 Begin
   Swap:=(X and $ffff) shl 16 + (X shr 16)
   Swap:=(X and $ffff) shl 16 + (X shr 16)
 End;
 End;
 
 
-Function Swap (X : Cardinal) : Cardinal;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_swap_long];
+Function Swap (X : Cardinal) : Cardinal;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_swap_long];{$endif}
 Begin
 Begin
   Swap:=(X and $ffff) shl 16 + (X shr 16)
   Swap:=(X and $ffff) shl 16 + (X shr 16)
 End;
 End;
 
 
-Function Swap (X : QWord) : QWord;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_swap_qword];
+Function Swap (X : QWord) : QWord;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_swap_qword];{$endif}
 Begin
 Begin
   Swap:=(X and $ffffffff) shl 32 + (X shr 32);
   Swap:=(X and $ffffffff) shl 32 + (X shr 32);
 End;
 End;
 
 
-Function swap (X : Int64) : Int64;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_swap_qword];
+Function swap (X : Int64) : Int64;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_swap_qword];{$endif}
 Begin
 Begin
   Swap:=(X and $ffffffff) shl 32 + (X shr 32);
   Swap:=(X and $ffffffff) shl 32 + (X shr 32);
 End;
 End;
 
 
+{$ifdef SUPPORT_DOUBLE}
 operator := (b:real48) d:double;
 operator := (b:real48) d:double;
-
 begin
 begin
  D:=real2double(b);
  D:=real2double(b);
 end;
 end;
+{$endif SUPPORT_DOUBLE}
 
 
 {$ifdef SUPPORT_EXTENDED}
 {$ifdef SUPPORT_EXTENDED}
 operator := (b:real48) e:extended;
 operator := (b:real48) e:extended;
-
 begin
 begin
  e:=real2double(b);
  e:=real2double(b);
 end;
 end;
@@ -477,7 +477,7 @@ end;
                             Memory Management
                             Memory Management
 ****************************************************************************}
 ****************************************************************************}
 
 
-Function Ptr(sel,off : Longint) : farpointer;{$ifdef SYSTEMINLINE}inline;{$endif}[internconst:in_const_ptr];
+Function Ptr(sel,off : Longint) : farpointer;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifndef INTERNCONSTINTF}[internconst:fpc_in_const_ptr];{$endif}
 Begin
 Begin
   ptr:=farpointer((sel shl 4)+off);
   ptr:=farpointer((sel shl 4)+off);
 End;
 End;
@@ -853,7 +853,7 @@ begin
     end;
     end;
   for i:=low(s) to high(s) do
   for i:=low(s) to high(s) do
      p[i+Reserveentries]:=pchar(s[i]);
      p[i+Reserveentries]:=pchar(s[i]);
-  p[high(s)+1+Reserveentries]:=nil; 
+  p[high(s)+1+Reserveentries]:=nil;
   ArrayStringToPPchar:=p;
   ArrayStringToPPchar:=p;
 end;
 end;
 
 
@@ -885,9 +885,9 @@ begin
       inc(buf);
       inc(buf);
      inc(nr);
      inc(nr);
      if buf^='"' Then			// quotes argument?
      if buf^='"' Then			// quotes argument?
-      begin 
+      begin
 	inc(buf);
 	inc(buf);
-	while not (buf^ in [#0,'"']) do	// then end of argument is end of string or next quote 
+	while not (buf^ in [#0,'"']) do	// then end of argument is end of string or next quote
 	 inc(buf);
 	 inc(buf);
         if buf^='"' then		// skip closing quote.
         if buf^='"' then		// skip closing quote.
 	  inc(buf);
 	  inc(buf);
@@ -896,7 +896,7 @@ begin
        begin				// else std
        begin				// else std
 	 while not (buf^ in [' ',#0,#9,#10]) do
 	 while not (buf^ in [' ',#0,#9,#10]) do
 	   inc(buf);
 	   inc(buf);
-       end;	
+       end;
    end;
    end;
   getmem(p,(ReserveEntries+nr)*sizeof(pchar));
   getmem(p,(ReserveEntries+nr)*sizeof(pchar));
   StringToPPChar:=p;
   StringToPPChar:=p;
@@ -917,12 +917,12 @@ begin
        inc(buf);
        inc(buf);
       end;
       end;
      if buf^='"' Then			// quotes argument?
      if buf^='"' Then			// quotes argument?
-      begin 
+      begin
 	inc(buf);
 	inc(buf);
         p^:=buf;
         p^:=buf;
 	inc(p);
 	inc(p);
 	p^:=nil;
 	p^:=nil;
-	while not (buf^ in [#0,'"']) do	// then end of argument is end of string or next quote 
+	while not (buf^ in [#0,'"']) do	// then end of argument is end of string or next quote
 	 inc(buf);
 	 inc(buf);
         if buf^='"' then		// skip closing quote.
         if buf^='"' then		// skip closing quote.
 	  begin
 	  begin
@@ -937,7 +937,7 @@ begin
 	p^:=nil;
 	p^:=nil;
 	 while not (buf^ in [' ',#0,#9,#10]) do
 	 while not (buf^ in [' ',#0,#9,#10]) do
 	   inc(buf);
 	   inc(buf);
-       end;	
+       end;
    end;
    end;
 end;
 end;
 
 
@@ -948,17 +948,13 @@ end;
                           Abstract/Assert support.
                           Abstract/Assert support.
 *****************************************************************************}
 *****************************************************************************}
 
 
-procedure AbstractError;[public,alias : 'FPC_ABSTRACTERROR'];
+procedure fpc_AbstractErrorIntern;{$ifdef hascompilerproc}compilerproc;{$endif}[public,alias : 'FPC_ABSTRACTERROR'];
 begin
 begin
   If pointer(AbstractErrorProc)<>nil then
   If pointer(AbstractErrorProc)<>nil then
     AbstractErrorProc();
     AbstractErrorProc();
   HandleErrorFrame(211,get_frame);
   HandleErrorFrame(211,get_frame);
 end;
 end;
 
 
-{$ifdef hascompilerproc}
-{ alias for internal usage in the compiler }
-procedure fpc_AbstractErrorIntern;  compilerproc; external name 'FPC_ABSTRACTERROR';
-{$endif hascompilerproc}
 
 
 Procedure fpc_assert(Const Msg,FName:Shortstring;LineNo:Longint;ErrorAddr:Pointer);{$ifndef NOSAVEREGISTERS}saveregisters;{$endif} [Public,Alias : 'FPC_ASSERT']; {$ifdef hascompilerproc} compilerproc; {$endif}
 Procedure fpc_assert(Const Msg,FName:Shortstring;LineNo:Longint;ErrorAddr:Pointer);{$ifndef NOSAVEREGISTERS}saveregisters;{$endif} [Public,Alias : 'FPC_ASSERT']; {$ifdef hascompilerproc} compilerproc; {$endif}
 begin
 begin
@@ -1002,7 +998,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.67  2004-10-30 20:49:10  marco
+  Revision 1.68  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.67  2004/10/30 20:49:10  marco
    * arraytostring added
    * arraytostring added
 
 
   Revision 1.66  2004/10/24 20:01:42  peter
   Revision 1.66  2004/10/24 20:01:42  peter

+ 55 - 38
rtl/inc/systemh.inc

@@ -280,7 +280,7 @@ Type
 
 
   { Needed for fpc_get_output }
   { Needed for fpc_get_output }
   PText               = ^Text;
   PText               = ^Text;
-  
+
   TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
   TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
 
 
 { procedure type }
 { procedure type }
@@ -371,6 +371,11 @@ Var
   StackBottom : Pointer;
   StackBottom : Pointer;
   StackLength : Cardinal;
   StackLength : Cardinal;
 
 
+
+{ Numbers for routines that have compiler magic }
+{$I innr.inc}
+
+
 {****************************************************************************
 {****************************************************************************
                         Processor specific routines
                         Processor specific routines
 ****************************************************************************}
 ****************************************************************************}
@@ -399,33 +404,34 @@ function  CompareDWord(const buf1,buf2;len:SizeInt):SizeInt;
 procedure MoveChar0(const buf1;var buf2;len:SizeInt);
 procedure MoveChar0(const buf1;var buf2;len:SizeInt);
 function  IndexChar0(const buf;len:SizeInt;b:char):SizeInt;
 function  IndexChar0(const buf;len:SizeInt;b:char):SizeInt;
 function  CompareChar0(const buf1,buf2;len:SizeInt):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
 function  CompareChar0(const buf1,buf2;len:SizeInt):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
-procedure prefetch(const mem);
+procedure prefetch(const mem);{$ifdef INTERNCONSTINTF}[internproc:fpc_in_prefetch_var];{$endif}
 
 
 
 
 {****************************************************************************
 {****************************************************************************
                           Math Routines
                           Math Routines
 ****************************************************************************}
 ****************************************************************************}
 
 
-Function  lo(w:Word):byte;
-Function  lo(l:Longint):Word;
-Function  lo(l:DWord):Word;
-Function  lo(i:Integer):byte;
 Function  lo(B: Byte):Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function  lo(B: Byte):Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function  hi(w:Word):byte;
-Function  hi(i:Integer):byte;
-Function  hi(l:Longint):Word;
 Function  hi(b : Byte) : Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function  hi(b : Byte) : Byte;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function  hi(l: DWord): Word;
-Function  lo(q : QWord) : DWord;
-Function  lo(i : Int64) : DWord;
-Function  hi(q : QWord) : DWord;
-Function  hi(i : Int64) : DWord;
-Function  Swap (X:Word):Word;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function  Swap (X:Integer):Integer;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function  Swap (X:Cardinal):Cardinal;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function  Swap (X:LongInt):LongInt;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function  Swap (X:QWord):QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function  Swap (X:Int64):Int64;{$ifdef SYSTEMINLINE}inline;{$endif}
+Function  lo(i : Integer) : byte;  {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_Word];{$endif}
+Function  lo(w : Word) : byte;     {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_Word];{$endif}
+Function  lo(l : Longint) : Word;  {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_long];{$endif}
+Function  lo(l : DWord) : Word;    {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_long];{$endif}
+Function  lo(i : Int64) : DWord;   {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_qword];{$endif}
+Function  lo(q : QWord) : DWord;   {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_lo_qword];{$endif}
+Function  hi(i : Integer) : byte;  {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_Word];{$endif}
+Function  hi(w : Word) : byte;     {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_Word];{$endif}
+Function  hi(l : Longint) : Word;  {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_long];{$endif}
+Function  hi(l : DWord) : Word;    {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_long];{$endif}
+Function  hi(i : Int64) : DWord;   {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_qword];{$endif}
+Function  hi(q : QWord) : DWord;   {$ifdef INTERNCONSTINTF}[INTERNPROC: fpc_in_hi_qword];{$endif}
+
+Function swap (X : Word) : Word;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_word];{$endif}
+Function Swap (X : Integer) : Integer;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_word];{$endif}
+Function swap (X : Longint) : Longint;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_long];{$endif}
+Function Swap (X : Cardinal) : Cardinal;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_long];{$endif}
+Function Swap (X : QWord) : QWord;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_qword];{$endif}
+Function swap (X : Int64) : Int64;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_swap_qword];{$endif}
 
 
 Function Align (Addr : PtrInt; Alignment : PtrInt) : PtrInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Align (Addr : PtrInt; Alignment : PtrInt) : PtrInt;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Align (Addr : Pointer; Alignment : PtrInt) : Pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function Align (Addr : Pointer; Alignment : PtrInt) : Pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
@@ -435,15 +441,15 @@ Function  Random(l:int64):int64;
 Function  Random: extended;
 Function  Random: extended;
 Procedure Randomize;
 Procedure Randomize;
 
 
-Function abs(l:Longint):Longint;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function abs(l:Int64):Int64;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function sqr(l:Longint):Longint;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function sqr(l:Int64):Int64;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function sqr(l:QWord):QWord;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function odd(l:Longint):Boolean;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function odd(l:Longword):Boolean;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function odd(l:Int64):Boolean;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function odd(l:QWord):Boolean;{$ifdef SYSTEMINLINE}inline;{$endif}
+Function abs(l:Longint):Longint;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_abs];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
+Function abs(l:Int64):Int64;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_abs];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
+Function sqr(l:Longint):Longint;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
+Function sqr(l:Int64):Int64;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
+Function sqr(l:QWord):QWord;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_sqr];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
+Function odd(l:Longint):Boolean;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
+Function odd(l:Longword):Boolean;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
+Function odd(l:Int64):Boolean;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
+Function odd(l:QWord):Boolean;{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_odd];{$endif}{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 { float math routines }
 { float math routines }
 {$I mathh.inc}
 {$I mathh.inc}
@@ -465,8 +471,8 @@ Function  Sseg:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
                       PChar and String Handling
                       PChar and String Handling
 ****************************************************************************}
 ****************************************************************************}
 
 
-function strpas(p:pchar):shortstring;
-function strlen(p:pchar):longint;{$ifdef INLINEGENERICS}inline;{$endif}
+function strpas(p:pchar):shortstring;external name 'FPC_PCHAR_TO_SHORTSTR';
+function strlen(p:pchar):longint;external name 'FPC_PCHAR_LENGTH';
 
 
 { Shortstring functions }
 { Shortstring functions }
 {$ifndef INTERNSETLENGTH}
 {$ifndef INTERNSETLENGTH}
@@ -496,7 +502,11 @@ Function  OctStr(Val:int64;cnt:byte):shortstring;
 Function  binStr(Val:int64;cnt:byte):shortstring;
 Function  binStr(Val:int64;cnt:byte):shortstring;
 
 
 { Char functions }
 { Char functions }
+{$ifdef INTERNCONSTINTF}
+Function chr(b : byte) : Char;      [INTERNPROC: fpc_in_chr_byte];
+{$else}
 Function  Chr(b:byte):Char;
 Function  Chr(b:byte):Char;
+{$endif}
 Function  upCase(c:Char):Char;
 Function  upCase(c:Char):Char;
 Function  lowerCase(c:Char):Char; overload;
 Function  lowerCase(c:Char):Char; overload;
 {$ifndef InternCopy}
 {$ifndef InternCopy}
@@ -515,7 +525,7 @@ function  length(c:char):byte;
 {$ifndef INTERNSETLENGTH}
 {$ifndef INTERNSETLENGTH}
 Procedure SetLength (Var S : AnsiString; l : SizeInt);
 Procedure SetLength (Var S : AnsiString; l : SizeInt);
 {$endif INTERNSETLENGTH}
 {$endif INTERNSETLENGTH}
-Procedure UniqueString (Var S : AnsiString);
+Procedure UniqueString(Var S : AnsiString);external name 'FPC_ANSISTR_UNIQUE';
 {$ifndef INTERNLENGTH}
 {$ifndef INTERNLENGTH}
 Function  Length (Const S : AnsiString) : SizeInt;
 Function  Length (Const S : AnsiString) : SizeInt;
 {$endif INTERNLENGTH}
 {$endif INTERNLENGTH}
@@ -539,7 +549,7 @@ function  lowercase(const s : ansistring) : ansistring;
 {$ifndef INTERNSETLENGTH}
 {$ifndef INTERNSETLENGTH}
 Procedure SetLength (Var S : WideString; l : SizeInt);
 Procedure SetLength (Var S : WideString; l : SizeInt);
 {$endif INTERNSETLENGTH}
 {$endif INTERNSETLENGTH}
-Procedure UniqueString (Var S : WideString);
+procedure UniqueString(Var S : WideString);external name 'FPC_WIDESTR_UNIQUE';
 {$ifndef INTERNLENGTH}
 {$ifndef INTERNLENGTH}
 Function  Length (Const S : WideString) : SizeInt;
 Function  Length (Const S : WideString) : SizeInt;
 {$endif INTERNLENGTH}
 {$endif INTERNLENGTH}
@@ -639,9 +649,13 @@ Procedure Truncate (Var F:File);
 Procedure Assign(Var f:TypedFile;const Name:string);
 Procedure Assign(Var f:TypedFile;const Name:string);
 Procedure Assign(Var f:TypedFile;p:pchar);
 Procedure Assign(Var f:TypedFile;p:pchar);
 Procedure Assign(Var f:TypedFile;c:char);
 Procedure Assign(Var f:TypedFile;c:char);
+{$ifdef INTERNCONSTINTF}
+Procedure Reset(var f : TypedFile);   [INTERNPROC: fpc_in_Reset_TypedFile];
+Procedure Rewrite(var f : TypedFile); [INTERNPROC: fpc_in_Rewrite_TypedFile];
+{$else}
 Procedure Rewrite(Var f:TypedFile);
 Procedure Rewrite(Var f:TypedFile);
 Procedure Reset(Var f:TypedFile);
 Procedure Reset(Var f:TypedFile);
-
+{$endif}
 
 
 {****************************************************************************
 {****************************************************************************
                             Text File Management
                             Text File Management
@@ -667,7 +681,7 @@ Function  SeekEOLn (Var t:Text):Boolean;
 Function  SeekEOF (Var t:Text):Boolean;
 Function  SeekEOF (Var t:Text):Boolean;
 Function  SeekEOLn:Boolean;
 Function  SeekEOLn:Boolean;
 Function  SeekEOF:Boolean;
 Function  SeekEOF:Boolean;
-Procedure SetTextBuf(Var f:Text; Var Buf);
+Procedure SetTextBuf(Var f:Text; Var Buf);{$ifdef INTERNCONSTINTF}[INTERNPROC:fpc_in_settextbuf_file_x];{$endif}
 Procedure SetTextBuf(Var f:Text; Var Buf; Size:Longint);
 Procedure SetTextBuf(Var f:Text; Var Buf; Size:Longint);
 Procedure SetTextLineEnding(Var f:Text; Ending:string);
 Procedure SetTextLineEnding(Var f:Text; Ending:string);
 
 
@@ -692,7 +706,7 @@ function get_caller_addr(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$
 function get_caller_frame(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
 function get_caller_frame(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
 
 
 Function IOResult:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
 Function IOResult:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
-Function Sptr:Pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
+Function Sptr:Pointer;{$ifdef SYSTEMINLINE}inline;{$endif}{$ifdef INTERNCONSTINTF}[internconst:fpc_in_const_ptr];{$endif}
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -722,7 +736,7 @@ Function StringToPPChar(Var S:AnsiString;ReserveEntries:integer):ppchar;
 Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
 Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
 
 
 
 
-procedure AbstractError;
+procedure AbstractError;external name 'FPC_ABSTRACTERROR';
 Function  SysBackTraceStr(Addr:Pointer): ShortString;
 Function  SysBackTraceStr(Addr:Pointer): ShortString;
 Procedure SysAssert(Const Msg,FName:ShortString;LineNo:Longint;ErrorAddr:Pointer);
 Procedure SysAssert(Const Msg,FName:ShortString;LineNo:Longint;ErrorAddr:Pointer);
 
 
@@ -773,7 +787,10 @@ const
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.107  2004-11-09 23:10:22  peter
+  Revision 1.108  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.107  2004/11/09 23:10:22  peter
     * use helper call to retrieve address of input/output to reduce
     * use helper call to retrieve address of input/output to reduce
       code that is generated in the main program for loading the
       code that is generated in the main program for loading the
       threadvar
       threadvar

+ 8 - 3
rtl/inc/text.inc

@@ -425,7 +425,9 @@ Begin
 End;
 End;
 
 
 
 
-Procedure SetTextBuf(Var F : Text; Var Buf);[INTERNPROC: In_settextbuf_file_x];
+{$ifndef INTERNCONSTINTF}
+Procedure SetTextBuf(Var F : Text; Var Buf);[INTERNPROC: fpc_In_settextbuf_file_x];
+{$endif}
 
 
 
 
 Procedure SetTextBuf(Var F : Text; Var Buf; Size : Longint);
 Procedure SetTextBuf(Var F : Text; Var Buf; Size : Longint);
@@ -669,7 +671,7 @@ var
 begin
 begin
   if (InOutRes<>0) then
   if (InOutRes<>0) then
    exit;
    exit;
-  str(q,s); 
+  str(q,s);
   write_str(len,t,s);
   write_str(len,t,s);
 end;
 end;
 
 
@@ -1289,7 +1291,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.27  2004-11-09 23:10:22  peter
+  Revision 1.28  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.27  2004/11/09 23:10:22  peter
     * use helper call to retrieve address of input/output to reduce
     * use helper call to retrieve address of input/output to reduce
       code that is generated in the main program for loading the
       code that is generated in the main program for loading the
       threadvar
       threadvar

+ 5 - 5
rtl/inc/wstrings.inc

@@ -678,9 +678,6 @@ end;
 {$endif INTERNLENGTH}
 {$endif INTERNLENGTH}
 
 
 
 
-{ overloaded version of UniqueString for interface }
-procedure UniqueString(Var S : WideString); [external name 'FPC_WIDESTR_UNIQUE'];
-
 Function fpc_widestr_Unique(Var S : Pointer): Pointer; [Public,Alias : 'FPC_WIDESTR_UNIQUE']; {$ifdef hascompilerproc} compilerproc; {$endif}
 Function fpc_widestr_Unique(Var S : Pointer): Pointer; [Public,Alias : 'FPC_WIDESTR_UNIQUE']; {$ifdef hascompilerproc} compilerproc; {$endif}
 {
 {
   Make sure reference count of S is 1,
   Make sure reference count of S is 1,
@@ -935,7 +932,7 @@ begin
   else
   else
     begin
     begin
       SS := S;
       SS := S;
-      fpc_Val_SInt_WideStr := fpc_Val_SInt_ShortStr(DestSize,SS,Code);
+      fpc_Val_SInt_WideStr := int_Val_SInt_ShortStr(DestSize,SS,Code);
     end;
     end;
 end;
 end;
 
 
@@ -1237,7 +1234,10 @@ function Utf8ToAnsi(const s : UTF8String) : ansistring;{$ifdef SYSTEMINLINE}inli
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.45  2004-10-24 20:01:42  peter
+  Revision 1.46  2004-11-17 22:19:04  peter
+  internconst, internproc and some external declarations moved to interface
+
+  Revision 1.45  2004/10/24 20:01:42  peter
     * saveregisters calling convention is obsolete
     * saveregisters calling convention is obsolete
 
 
   Revision 1.44  2004/09/29 14:55:49  mazen
   Revision 1.44  2004/09/29 14:55:49  mazen