version 1.1, 1999/03/02 15:50:04
|
version 1.4, 2000/09/23 15:47:00
|
Line 1
|
Line 1
|
\ wordlib.fs Handle shared library with forth primitive extentions 9oct97jaw |
\ wordlib.fs Handle shared library with forth primitive extentions 9oct97jaw |
|
|
\ Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1996,1997,1998,1999 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. |
|
|
\ Author: Jens Wilke |
\ Author: Jens Wilke |
\ Revision Log |
\ Revision Log |
Line 29
|
Line 29
|
|
|
0 Value wlib \ temporary library handle to make live easy |
0 Value wlib \ temporary library handle to make live easy |
|
|
: wl-catalog ( n -- addr | u ) |
: wl-catalog ( n lib-addr -- addr | u ) |
s" catalog" wlib lib-sym dup 0= |
s" catalog" rot lib-sym dup 0= |
ABORT" No word catalog" |
ABORT" No word catalog" |
icall1 ; |
icall1 ; |
|
|
: wl-words ( lib-addr -- ) |
: wl-words ( lib-addr -- ) |
to wlib 0 |
0 |
BEGIN dup wl-catalog ?dup |
BEGIN 2dup swap wl-catalog ?dup |
WHILE cell+ count type space |
WHILE cell+ count type space |
1+ |
1+ |
REPEAT drop ; |
REPEAT 2drop ; |
|
|
: wl-create ( adr adr2 len2 -- ) |
: wl-create ( adr adr2 len2 -- ) |
nextname |
nextname |
Create , |
Create , |
DOES> @ call-c ; |
DOES> @ wcall ; |
|
|
: wl-tovoc ( -- ) |
: wl-tovoc ( lib-addr -- ) |
0 |
0 |
BEGIN dup wl-catalog ?dup |
BEGIN 2dup swap wl-catalog ?dup |
WHILE dup @ swap cell+ count wl-create |
WHILE dup @ swap cell+ count wl-create |
1+ |
1+ |
REPEAT drop ; |
REPEAT 2drop ; |
|
|
: (WordLibrary) |
: (WordLibrary) |
Create DOES> @ ; |
Create DOES> @ ; |
Line 62
|
Line 62
|
bl word count open-fpath-file throw rot close-file throw |
bl word count open-fpath-file throw rot close-file throw |
\ open library with correct path |
\ open library with correct path |
open-lib |
open-lib |
dup 0= ABORT" Library not found" |
dup 0= ABORT" Library load error" |
dup to wlib , |
dup , |
wl-tovoc ; |
wl-tovoc ; |