Diff for /gforth/fflib.fs between versions 1.8 and 1.18

version 1.8, 2005/11/27 22:47:18 version 1.18, 2007/12/31 18:40:24
Line 1 Line 1
 \ lib.fs        shared library support package          16aug03py  \ lib.fs        shared library support package          16aug03py
   
 \ Copyright (C) 1995,1996,1997,1998,2000,2003 Free Software Foundation, Inc.  \ Copyright (C) 1995,1996,1997,1998,2000,2003,2005,2006,2007 Free Software Foundation, Inc.
   
 \ This file is part of Gforth.  \ This file is part of Gforth.
   
 \ Gforth is free software; you can redistribute it and/or  \ Gforth is free software; you can redistribute it and/or
 \ modify it under the terms of the GNU General Public License  \ modify it under the terms of the GNU General Public License
 \ as published by the Free Software Foundation; either version 2  \ as published by the Free Software Foundation, either version 3
 \ of the License, or (at your option) any later version.  \ of the License, or (at your option) any later version.
   
 \ This program is distributed in the hope that it will be useful,  \ This program is distributed in the hope that it will be useful,
Line 15 Line 15
 \ GNU General Public License for more details.  \ GNU General Public License for more details.
   
 \ You should have received a copy of the GNU General Public License  \ You should have received a copy of the GNU General Public License
 \ along with this program; if not, write to the Free Software  \ along with this program. If not, see http://www.gnu.org/licenses/.
 \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.  
   
 Variable libs 0 libs !  Variable libs 0 libs !
 \ links between libraries  \ links between libraries
Line 63  Defer legacy-proc  ' noop IS legacy-proc Line 62  Defer legacy-proc  ' noop IS legacy-proc
 DOES> ( x1 .. xn -- r )  DOES> ( x1 .. xn -- r )
     dup cell+ @ swap 3 cells + >r ;      dup cell+ @ swap 3 cells + >r ;
   
   Variable ind-call ind-call off
   : fptr ( "name" -- )
       Create here thisproc ! 0 , 0 , 0 ,  0 also c-decl  ind-call on
       DOES>  3 cells + >r ;
   
 : library ( "name" "file" -- )  : library ( "name" "file" -- )
 \G loads library "file" and creates a proc defining word "name"  \G loads library "file" and creates a proc defining word "name"
 \G library format:  \G library format:
Line 75  DOES> ( x1 .. xn -- r ) Line 79  DOES> ( x1 .. xn -- r )
 DOES> ( -- )  dup thislib ! proc: ;  DOES> ( -- )  dup thislib ! proc: ;
   
 : init-shared-libs ( -- )  : init-shared-libs ( -- )
     defers 'cold  libs      defers 'cold
     0  libs  BEGIN  @ dup  WHILE  dup  REPEAT  drop      0  libs  BEGIN
     BEGIN  dup  WHILE  >r          @ dup WHILE
         r@ @lib              dup  REPEAT
         r@ 2 cells +  BEGIN  @ dup  WHILE  r@ over @proc  REPEAT      drop BEGIN
         drop rdrop          dup  WHILE
     REPEAT  drop ;              >r
               r@ @lib
               r@ 2 cells +  BEGIN
                   @ dup  WHILE
                       r@ over @proc  REPEAT
               drop rdrop
       REPEAT
       drop ;
   
 ' init-shared-libs IS 'cold  ' init-shared-libs IS 'cold
   
Line 112  DOES> ( -- )  dup thislib ! proc: ; Line 123  DOES> ( -- )  dup thislib ! proc: ;
   
 : rettype ( endxt startxt "name" -- )  : rettype ( endxt startxt "name" -- )
     Create 2,      Create 2,
   DOES>  decl, symbol, previous revarg off ;    DOES>  decl, ind-call @ 0= IF  symbol,  THEN
       previous revarg off ind-call off ;
   
 also c-decl definitions  also c-decl definitions
   
Line 121  also c-decl definitions Line 133  also c-decl definitions
 ' av-int      ' av-int-r      ' >r  argtype int  ' av-int      ' av-int-r      ' >r  argtype int
 ' av-float    ' av-float-r    ' f>l argtype sf  ' av-float    ' av-float-r    ' f>l argtype sf
 ' av-double   ' av-double-r   ' f>l argtype df  ' av-double   ' av-double-r   ' f>l argtype df
 ' av-longlong ' av-longlong-r ' 2>r argtype llong  ' av-longlong ' av-longlong-r ' 2>r argtype dlong
 ' av-ptr      ' av-ptr-r      ' >r  argtype ptr  ' av-ptr      ' av-ptr-r      ' >r  argtype ptr
   
 ' av-call-void     ' av-start-void     rettype (void)  ' av-call-void     ' av-start-void     rettype (void)
 ' av-call-int      ' av-start-int      rettype (int)  ' av-call-int      ' av-start-int      rettype (int)
 ' av-call-float    ' av-start-float    rettype (sf)  ' av-call-float    ' av-start-float    rettype (sf)
 ' av-call-double   ' av-start-double   rettype (fp)  ' av-call-double   ' av-start-double   rettype (fp)
 ' av-call-longlong ' av-start-longlong rettype (llong)  ' av-call-longlong ' av-start-longlong rettype (dlong)
 ' av-call-ptr      ' av-start-ptr      rettype (ptr)  ' av-call-ptr      ' av-start-ptr      rettype (ptr)
   
 : (addr)  postpone EXIT  symbol, previos revarg off ;  : (addr)  postpone EXIT drop symbol, previous revarg off ;
   
 previous definitions  previous definitions
   
Line 190  also cb-decl definitions Line 202  also cb-decl definitions
 ' va-arg-int      Alias int  ' va-arg-int      Alias int
 ' va-arg-float    Alias sf  ' va-arg-float    Alias sf
 ' va-arg-double   Alias df  ' va-arg-double   Alias df
 ' va-arg-longlong Alias llong  ' va-arg-longlong Alias dlong
 ' va-arg-ptr      Alias ptr  ' va-arg-ptr      Alias ptr
   
 ' va-return-void     ' va-start-void     va-ret (void)  ' va-return-void     ' va-start-void     va-ret (void)
 ' va-return-int      ' va-start-int      va-ret (int)  ' va-return-int      ' va-start-int      va-ret (int)
 ' va-return-float    ' va-start-float    va-ret (sf)  ' va-return-float    ' va-start-float    va-ret (sf)
 ' va-return-double   ' va-start-double   va-ret (fp)  ' va-return-double   ' va-start-double   va-ret (fp)
 ' va-return-longlong ' va-start-longlong va-ret (llong)  ' va-return-longlong ' va-start-longlong va-ret (dlong)
 ' va-return-ptr      ' va-start-ptr      va-ret (ptr)  ' va-return-ptr      ' va-start-ptr      va-ret (ptr)
   
 previous definitions  previous definitions

Removed from v.1.8  
changed lines
  Added in v.1.18


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>