--- gforth/lib.fs 1997/05/29 19:42:13 1.1 +++ gforth/lib.fs 2000/09/23 15:46:57 1.5 @@ -1,6 +1,6 @@ \ lib.fs shared library support package 11may97py -\ Copyright (C) 1995-1997 Free Software Foundation, Inc. +\ Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. \ This file is part of Gforth. @@ -16,7 +16,7 @@ \ You should have received a copy of the GNU General Public License \ along with this program; if not, write to the Free Software -\ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. Create icall-table ] icall0 ;s icall1 ;s icall2 ;s icall3 ;s icall4 ;s icall5 ;s icall6 ;s @@ -49,7 +49,7 @@ Variable libs 0 libs ! \G OS name of symbol as counted string here 2dup swap 2 cells + dup @ A, ! 2swap 1 and IF fcall-table ELSE icall-table THEN swap - cells 2* + , 0 , bl parse-word string, @proc ; + cells 2* + , 0 , bl sword string, @proc ; -1 Constant (addr) 0 Constant (int) @@ -91,7 +91,7 @@ DOES> ( x1 .. xn n -- ) DOES> ( -- addr ) [ 2 cells ] Literal + @ ; -: lib: ( "name" "file" -- ) +: library ( "name" "file" -- ) \G loads library "file" and creates a proc defining word "name" \G library format: \G linked list of libraries @@ -99,7 +99,7 @@ DOES> ( -- addr ) \G linked list of library's procs \G OS name of library as counted string Create here libs @ A, dup libs ! - 0 , 0 A, bl parse-word string, @lib + 0 , 0 A, bl sword string, @lib DOES> ( pars/ type -- ) over -1 = IF label: ELSE @@ -112,10 +112,11 @@ DOES> ( pars/ type -- ) : init-shared-libs ( -- ) defers 'cold libs - BEGIN @ dup WHILE >r + 0 libs BEGIN @ dup WHILE dup REPEAT drop + BEGIN dup WHILE >r r@ @lib r@ 2 cells + BEGIN @ dup WHILE r@ over @proc REPEAT - drop r> - REPEAT drop ; + drop rdrop + REPEAT drop ; ' init-shared-libs IS 'cold