version 1.1, 1999/03/02 15:50:04
|
version 1.8, 2007/12/31 19:02:24
|
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,2000,2003,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., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
|
|
\ Author: Jens Wilke |
\ Author: Jens Wilke |
\ Revision Log |
\ Revision Log |
Line 29
|
Line 28
|
|
|
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 61
|
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 ; |