version 1.1, 1997/05/29 19:42:13
|
version 1.5, 2000/09/23 15:46:57
|
Line 1
|
Line 1
|
\ lib.fs shared library support package 11may97py |
\ 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. |
\ This file is part of Gforth. |
|
|
Line 16
|
Line 16
|
|
|
\ 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, 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 |
Create icall-table |
] icall0 ;s icall1 ;s icall2 ;s icall3 ;s icall4 ;s icall5 ;s icall6 ;s |
] icall0 ;s icall1 ;s icall2 ;s icall3 ;s icall4 ;s icall5 ;s icall6 ;s |
Line 49 Variable libs 0 libs !
|
Line 49 Variable libs 0 libs !
|
\G OS name of symbol as counted string |
\G OS name of symbol as counted string |
here 2dup swap 2 cells + dup @ A, ! |
here 2dup swap 2 cells + dup @ A, ! |
2swap 1 and IF fcall-table ELSE icall-table THEN swap |
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) |
-1 Constant (addr) |
0 Constant (int) |
0 Constant (int) |
Line 91 DOES> ( x1 .. xn n -- )
|
Line 91 DOES> ( x1 .. xn n -- )
|
DOES> ( -- addr ) |
DOES> ( -- addr ) |
[ 2 cells ] Literal + @ ; |
[ 2 cells ] Literal + @ ; |
|
|
: lib: ( "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: |
\G linked list of libraries |
\G linked list of libraries |
Line 99 DOES> ( -- addr )
|
Line 99 DOES> ( -- addr )
|
\G linked list of library's procs |
\G linked list of library's procs |
\G OS name of library as counted string |
\G OS name of library as counted string |
Create here libs @ A, dup libs ! |
Create here libs @ A, dup libs ! |
0 , 0 A, bl parse-word string, @lib |
0 , 0 A, bl sword string, @lib |
DOES> ( pars/ type -- ) |
DOES> ( pars/ type -- ) |
over -1 = IF label: |
over -1 = IF label: |
ELSE |
ELSE |
Line 112 DOES> ( pars/ type -- )
|
Line 112 DOES> ( pars/ type -- )
|
|
|
: init-shared-libs ( -- ) |
: init-shared-libs ( -- ) |
defers 'cold libs |
defers 'cold libs |
BEGIN @ dup WHILE >r |
0 libs BEGIN @ dup WHILE dup REPEAT drop |
|
BEGIN dup WHILE >r |
r@ @lib |
r@ @lib |
r@ 2 cells + BEGIN @ dup WHILE r@ over @proc REPEAT |
r@ 2 cells + BEGIN @ dup WHILE r@ over @proc REPEAT |
drop r> |
drop rdrop |
REPEAT drop ; |
REPEAT drop ; |
|
|
' init-shared-libs IS 'cold |
' init-shared-libs IS 'cold |